/*
 * 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 {
  PresentmentCurrency,
  PresentmentCurrency$outboundSchema,
} from "./presentmentcurrency.js";
import {
  TaxBehaviorOption,
  TaxBehaviorOption$outboundSchema,
} from "./taxbehavioroption.js";

/**
 * Schema to create a fixed price.
 */
export type ProductPriceFixedCreate = {
  amountType: "fixed";
  priceCurrency?: PresentmentCurrency | undefined;
  /**
   * The tax behavior of the price. If not set, it will default to the organization's default tax behavior.
   */
  taxBehavior?: TaxBehaviorOption | null | undefined;
  /**
   * The price in cents. Set to `0` for a free price.
   *
   * @remarks
   * Minimum amounts per currency:
   * - USD: 0.5
   * - AED: 2
   * - ALL: 50
   * - AMD: 200
   * - AOA: 500
   * - ARS: 750
   * - AUD: 0.7
   * - AWG: 1
   * - AZN: 1
   * - BAM: 1
   * - BBD: 2
   * - BDT: 70
   * - BIF: 2,000
   * - BMD: 1
   * - BND: 1
   * - BOB: 5
   * - BRL: 2.5
   * - BSD: 1
   * - BWP: 10
   * - BZD: 2
   * - CAD: 0.7
   * - CDF: 2,000
   * - CHF: 0.5
   * - CLP: 500
   * - CNY: 5
   * - COP: 2,000
   * - CRC: 300
   * - CVE: 50
   * - CZK: 15
   * - DJF: 100
   * - DKK: 3.2
   * - DOP: 40
   * - DZD: 70
   * - EGP: 30
   * - ETB: 80
   * - EUR: 0.5
   * - FJD: 2
   * - FKP: 1
   * - GBP: 0.4
   * - GEL: 2
   * - GNF: 5,000
   * - GIP: 1
   * - GMD: 40
   * - GTQ: 5
   * - GYD: 200
   * - HKD: 4
   * - HNL: 20
   * - HTG: 70
   * - HUF: 175
   * - IDR: 9,000
   * - ILS: 1.5
   * - INR: 60
   * - ISK: 70
   * - JMD: 80
   * - JPY: 80
   * - KES: 70
   * - KGS: 50
   * - KHR: 3,000
   * - KMF: 500
   * - KRW: 800
   * - KYD: 1
   * - KZT: 300
   * - LAK: 20,000
   * - LKR: 200
   * - LRD: 100
   * - LSL: 10
   * - MAD: 5
   * - MDL: 10
   * - MGA: 3,000
   * - MKD: 50
   * - MNT: 2,000
   * - MOP: 5
   * - MUR: 50
   * - MVR: 8
   * - MXN: 9
   * - MWK: 1,000
   * - MYR: 2
   * - MZN: 50
   * - NAD: 10
   * - NGN: 700
   * - NIO: 20
   * - NOK: 5
   * - NPR: 80
   * - NZD: 0.9
   * - PAB: 1
   * - PEN: 2
   * - PGK: 3
   * - PHP: 35
   * - PKR: 200
   * - PLN: 2
   * - PYG: 4,000
   * - QAR: 2
   * - RON: 2.5
   * - RSD: 60
   * - RWF: 1,000
   * - SAR: 2
   * - SBD: 4
   * - SCR: 8
   * - SEK: 5
   * - SGD: 0.7
   * - SHP: 1
   * - SOS: 500
   * - SRD: 20
   * - SZL: 10
   * - THB: 20
   * - TJS: 5
   * - TOP: 2
   * - TRY: 30
   * - TTD: 4
   * - TWD: 20
   * - TZS: 2,000
   * - UAH: 30
   * - UGX: 2,000
   * - UYU: 20
   * - UZS: 7,000
   * - VND: 20,000
   * - VUV: 100
   * - WST: 2
   * - XAF: 500
   * - XCD: 2
   * - XCG: 1
   * - XOF: 500
   * - XPF: 100
   * - YER: 200
   * - ZAR: 9
   * - ZMW: 10
   * - Other currencies: 50 minor units
   */
  priceAmount: number;
};

/** @internal */
export type ProductPriceFixedCreate$Outbound = {
  amount_type: "fixed";
  price_currency?: string | undefined;
  tax_behavior?: string | null | undefined;
  price_amount: number;
};

/** @internal */
export const ProductPriceFixedCreate$outboundSchema: z.ZodMiniType<
  ProductPriceFixedCreate$Outbound,
  ProductPriceFixedCreate
> = z.pipe(
  z.object({
    amountType: z.literal("fixed"),
    priceCurrency: z.optional(PresentmentCurrency$outboundSchema),
    taxBehavior: z.optional(z.nullable(TaxBehaviorOption$outboundSchema)),
    priceAmount: z.int(),
  }),
  z.transform((v) => {
    return remap$(v, {
      amountType: "amount_type",
      priceCurrency: "price_currency",
      taxBehavior: "tax_behavior",
      priceAmount: "price_amount",
    });
  }),
);

export function productPriceFixedCreateToJSON(
  productPriceFixedCreate: ProductPriceFixedCreate,
): string {
  return JSON.stringify(
    ProductPriceFixedCreate$outboundSchema.parse(productPriceFixedCreate),
  );
}
