/* * 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 { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "./sdk-validation-error.js"; export type PricePriceTier = { /** * flat_amount is the flat amount for the given tier (optional) * * @remarks * Applied on top of unit_amount*quantity. Useful for cases like "2.7$ + 5c" */ flatAmount?: string | undefined; /** * unit_amount is the amount per unit for the given tier */ unitAmount?: string | undefined; /** * up_to is the quantity up to which this tier applies. It is null for the last tier. * * @remarks * IMPORTANT: Tier boundaries are INCLUSIVE. * - If up_to is 1000, then quantity less than or equal to 1000 belongs to this tier * - This behavior is consistent across both VOLUME and SLAB tier modes */ upTo?: number | undefined; }; /** @internal */ export const PricePriceTier$inboundSchema: z.ZodMiniType< PricePriceTier, unknown > = z.pipe( z.object({ flat_amount: types.optional(types.string()), unit_amount: types.optional(types.string()), up_to: types.optional(types.number()), }), z.transform((v) => { return remap$(v, { "flat_amount": "flatAmount", "unit_amount": "unitAmount", "up_to": "upTo", }); }), ); export function pricePriceTierFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PricePriceTier$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PricePriceTier' from JSON`, ); }