/*
 * 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 {
  AddressInput,
  AddressInput$Outbound,
  AddressInput$outboundSchema,
} from "./addressinput.js";

export type CustomerPortalCustomerUpdate = {
  billingName?: string | null | undefined;
  billingAddress?: AddressInput | null | undefined;
  taxId?: string | null | undefined;
  defaultPaymentMethodId?: string | null | undefined;
};

/** @internal */
export type CustomerPortalCustomerUpdate$Outbound = {
  billing_name?: string | null | undefined;
  billing_address?: AddressInput$Outbound | null | undefined;
  tax_id?: string | null | undefined;
  default_payment_method_id?: string | null | undefined;
};

/** @internal */
export const CustomerPortalCustomerUpdate$outboundSchema: z.ZodMiniType<
  CustomerPortalCustomerUpdate$Outbound,
  CustomerPortalCustomerUpdate
> = z.pipe(
  z.object({
    billingName: z.optional(z.nullable(z.string())),
    billingAddress: z.optional(z.nullable(AddressInput$outboundSchema)),
    taxId: z.optional(z.nullable(z.string())),
    defaultPaymentMethodId: z.optional(z.nullable(z.string())),
  }),
  z.transform((v) => {
    return remap$(v, {
      billingName: "billing_name",
      billingAddress: "billing_address",
      taxId: "tax_id",
      defaultPaymentMethodId: "default_payment_method_id",
    });
  }),
);

export function customerPortalCustomerUpdateToJSON(
  customerPortalCustomerUpdate: CustomerPortalCustomerUpdate,
): string {
  return JSON.stringify(
    CustomerPortalCustomerUpdate$outboundSchema.parse(
      customerPortalCustomerUpdate,
    ),
  );
}
