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

import * as z from "zod/v4-mini";
import { smartUnion } from "../../types/smartUnion.js";

/**
 * The amount in cents.
 */
export type Amount = number | string;

export type CostMetadataInput = {
  /**
   * The amount in cents.
   */
  amount: number | string;
  /**
   * The currency. Currently, only `usd` is supported.
   */
  currency: string;
};

/** @internal */
export type Amount$Outbound = number | string;

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

export function amountToJSON(amount: Amount): string {
  return JSON.stringify(Amount$outboundSchema.parse(amount));
}

/** @internal */
export type CostMetadataInput$Outbound = {
  amount: number | string;
  currency: string;
};

/** @internal */
export const CostMetadataInput$outboundSchema: z.ZodMiniType<
  CostMetadataInput$Outbound,
  CostMetadataInput
> = z.object({
  amount: smartUnion([z.number(), z.string()]),
  currency: z.string(),
});

export function costMetadataInputToJSON(
  costMetadataInput: CostMetadataInput,
): string {
  return JSON.stringify(
    CostMetadataInput$outboundSchema.parse(costMetadataInput),
  );
}
