/*
 * 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 OrdersExportQueryParamOrganizationIDFilter = string | Array<string>;

/**
 * Filter by product ID.
 */
export type OrdersExportQueryParamProductIDFilter = string | Array<string>;

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

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

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

export function ordersExportQueryParamOrganizationIDFilterToJSON(
  ordersExportQueryParamOrganizationIDFilter:
    OrdersExportQueryParamOrganizationIDFilter,
): string {
  return JSON.stringify(
    OrdersExportQueryParamOrganizationIDFilter$outboundSchema.parse(
      ordersExportQueryParamOrganizationIDFilter,
    ),
  );
}

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

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

export function ordersExportQueryParamProductIDFilterToJSON(
  ordersExportQueryParamProductIDFilter: OrdersExportQueryParamProductIDFilter,
): string {
  return JSON.stringify(
    OrdersExportQueryParamProductIDFilter$outboundSchema.parse(
      ordersExportQueryParamProductIDFilter,
    ),
  );
}

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

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

export function ordersExportRequestToJSON(
  ordersExportRequest: OrdersExportRequest,
): string {
  return JSON.stringify(
    OrdersExportRequest$outboundSchema.parse(ordersExportRequest),
  );
}
