/*
 * 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 CustomerSeatAssign = {
  /**
   * 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;
  /**
   * Checkout ID. Resolves to the subscription or order produced by the checkout.
   */
  checkoutId?: string | null | undefined;
};

/** @internal */
export type CustomerSeatAssign$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;
  checkout_id?: string | null | undefined;
};

/** @internal */
export const CustomerSeatAssign$outboundSchema: z.ZodMiniType<
  CustomerSeatAssign$Outbound,
  CustomerSeatAssign
> = 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),
    checkoutId: z.optional(z.nullable(z.string())),
  }),
  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",
      checkoutId: "checkout_id",
    });
  }),
);

export function customerSeatAssignToJSON(
  customerSeatAssign: CustomerSeatAssign,
): string {
  return JSON.stringify(
    CustomerSeatAssign$outboundSchema.parse(customerSeatAssign),
  );
}
