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

import * as z from "zod/v4-mini";
import { smartUnion } from "../../types/smartUnion.js";
import {
  CustomerSessionCustomerExternalIDCreate,
  CustomerSessionCustomerExternalIDCreate$Outbound,
  CustomerSessionCustomerExternalIDCreate$outboundSchema,
} from "../components/customersessioncustomerexternalidcreate.js";
import {
  CustomerSessionCustomerIDCreate,
  CustomerSessionCustomerIDCreate$Outbound,
  CustomerSessionCustomerIDCreate$outboundSchema,
} from "../components/customersessioncustomeridcreate.js";

export type CustomerSessionsCreateCustomerSessionCreate =
  | CustomerSessionCustomerIDCreate
  | CustomerSessionCustomerExternalIDCreate;

/** @internal */
export type CustomerSessionsCreateCustomerSessionCreate$Outbound =
  | CustomerSessionCustomerIDCreate$Outbound
  | CustomerSessionCustomerExternalIDCreate$Outbound;

/** @internal */
export const CustomerSessionsCreateCustomerSessionCreate$outboundSchema:
  z.ZodMiniType<
    CustomerSessionsCreateCustomerSessionCreate$Outbound,
    CustomerSessionsCreateCustomerSessionCreate
  > = smartUnion([
    CustomerSessionCustomerIDCreate$outboundSchema,
    CustomerSessionCustomerExternalIDCreate$outboundSchema,
  ]);

export function customerSessionsCreateCustomerSessionCreateToJSON(
  customerSessionsCreateCustomerSessionCreate:
    CustomerSessionsCreateCustomerSessionCreate,
): string {
  return JSON.stringify(
    CustomerSessionsCreateCustomerSessionCreate$outboundSchema.parse(
      customerSessionsCreateCustomerSessionCreate,
    ),
  );
}
