/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v4-mini";
import { remap as remap$ } from "../../lib/primitives.js";

export type SeatAssign = {
  /**
   * Subscription ID. Required if neither order_id nor checkout_id is provided.
   */
  subscriptionId?: string | null | undefined;
  /**
   * Order ID for one-time purchases. Required if subscription_id is not provided.
   */
  orderId?: string | null | undefined;
  /**
   * Email of the customer to assign the seat to
   */
  email?: string | null | undefined;
  /**
   * External customer ID for the seat assignment
   */
  externalCustomerId?: string | null | undefined;
  /**
   * Customer ID for the seat assignment
   */
  customerId?: string | null | undefined;
  /**
   * External member ID for the seat assignment. Can be used alone (lookup existing member) or with email (create/validate member).
   */
  externalMemberId?: string | null | undefined;
  /**
   * Member ID for the seat assignment.
   */
  memberId?: string | null | undefined;
  /**
   * Additional metadata for the seat (max 10 keys, 1KB total)
   */
  metadata?: { [k: string]: any } | null | undefined;
  /**
   * If true, the seat will be immediately claimed without sending an invitation email. API-only feature.
   */
  immediateClaim?: boolean | undefined;
};

/** @internal */
export type SeatAssign$Outbound = {
  subscription_id?: string | null | undefined;
  order_id?: string | null | undefined;
  email?: string | null | undefined;
  external_customer_id?: string | null | undefined;
  customer_id?: string | null | undefined;
  external_member_id?: string | null | undefined;
  member_id?: string | null | undefined;
  metadata?: { [k: string]: any } | null | undefined;
  immediate_claim: boolean;
};

/** @internal */
export const SeatAssign$outboundSchema: z.ZodMiniType<
  SeatAssign$Outbound,
  SeatAssign
> = z.pipe(
  z.object({
    subscriptionId: z.optional(z.nullable(z.string())),
    orderId: z.optional(z.nullable(z.string())),
    email: z.optional(z.nullable(z.string())),
    externalCustomerId: z.optional(z.nullable(z.string())),
    customerId: z.optional(z.nullable(z.string())),
    externalMemberId: z.optional(z.nullable(z.string())),
    memberId: z.optional(z.nullable(z.string())),
    metadata: z.optional(z.nullable(z.record(z.string(), z.any()))),
    immediateClaim: z._default(z.boolean(), false),
  }),
  z.transform((v) => {
    return remap$(v, {
      subscriptionId: "subscription_id",
      orderId: "order_id",
      externalCustomerId: "external_customer_id",
      customerId: "customer_id",
      externalMemberId: "external_member_id",
      memberId: "member_id",
      immediateClaim: "immediate_claim",
    });
  }),
);

export function seatAssignToJSON(seatAssign: SeatAssign): string {
  return JSON.stringify(SeatAssign$outboundSchema.parse(seatAssign));
}
