/*
 * 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 { smartUnion } from "../../types/smartUnion.js";

/**
 * Filter by organization ID.
 */
export type CustomersExportQueryParamOrganizationId = string | Array<string>;

export type CustomersExportRequest = {
  /**
   * Filter by organization ID.
   */
  organizationId?: string | Array<string> | null | undefined;
};

/** @internal */
export type CustomersExportQueryParamOrganizationId$Outbound =
  | string
  | Array<string>;

/** @internal */
export const CustomersExportQueryParamOrganizationId$outboundSchema:
  z.ZodMiniType<
    CustomersExportQueryParamOrganizationId$Outbound,
    CustomersExportQueryParamOrganizationId
  > = smartUnion([z.string(), z.array(z.string())]);

export function customersExportQueryParamOrganizationIdToJSON(
  customersExportQueryParamOrganizationId:
    CustomersExportQueryParamOrganizationId,
): string {
  return JSON.stringify(
    CustomersExportQueryParamOrganizationId$outboundSchema.parse(
      customersExportQueryParamOrganizationId,
    ),
  );
}

/** @internal */
export type CustomersExportRequest$Outbound = {
  organization_id?: string | Array<string> | null | undefined;
};

/** @internal */
export const CustomersExportRequest$outboundSchema: z.ZodMiniType<
  CustomersExportRequest$Outbound,
  CustomersExportRequest
> = z.pipe(
  z.object({
    organizationId: z.optional(
      z.nullable(smartUnion([z.string(), z.array(z.string())])),
    ),
  }),
  z.transform((v) => {
    return remap$(v, {
      organizationId: "organization_id",
    });
  }),
);

export function customersExportRequestToJSON(
  customersExportRequest: CustomersExportRequest,
): string {
  return JSON.stringify(
    CustomersExportRequest$outboundSchema.parse(customersExportRequest),
  );
}
