/*
 * 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";
import {
  CustomerUpdateExternalID,
  CustomerUpdateExternalID$Outbound,
  CustomerUpdateExternalID$outboundSchema,
} from "../components/customerupdateexternalid.js";

export type CustomersUpdateExternalRequest = {
  /**
   * The customer external ID.
   */
  externalId: string;
  customerUpdateExternalID: CustomerUpdateExternalID;
};

/** @internal */
export type CustomersUpdateExternalRequest$Outbound = {
  external_id: string;
  CustomerUpdateExternalID: CustomerUpdateExternalID$Outbound;
};

/** @internal */
export const CustomersUpdateExternalRequest$outboundSchema: z.ZodMiniType<
  CustomersUpdateExternalRequest$Outbound,
  CustomersUpdateExternalRequest
> = z.pipe(
  z.object({
    externalId: z.string(),
    customerUpdateExternalID: CustomerUpdateExternalID$outboundSchema,
  }),
  z.transform((v) => {
    return remap$(v, {
      externalId: "external_id",
      customerUpdateExternalID: "CustomerUpdateExternalID",
    });
  }),
);

export function customersUpdateExternalRequestToJSON(
  customersUpdateExternalRequest: CustomersUpdateExternalRequest,
): string {
  return JSON.stringify(
    CustomersUpdateExternalRequest$outboundSchema.parse(
      customersUpdateExternalRequest,
    ),
  );
}
