/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * The minimum spending amount that must be met in the billing period. If actual usage is below the minimum amount, account is charged the difference. */ export type MinimumCommitment = { /** * A 3-letter ISO 4217 currency code. */ currency: string; /** * A decimal-formatted numerical string that represents up to 9 decimal place precision. * * @remarks * * For example, $12.987654321 is '12.987654321'. */ valueDecimal: string; }; /** @internal */ export const MinimumCommitment$inboundSchema: z.ZodType< MinimumCommitment, z.ZodTypeDef, unknown > = z.object({ currency: z.string(), valueDecimal: z.string(), }); /** @internal */ export type MinimumCommitment$Outbound = { currency: string; valueDecimal: string; }; /** @internal */ export const MinimumCommitment$outboundSchema: z.ZodType< MinimumCommitment$Outbound, z.ZodTypeDef, MinimumCommitment > = z.object({ currency: z.string(), valueDecimal: z.string(), }); export function minimumCommitmentToJSON( minimumCommitment: MinimumCommitment, ): string { return JSON.stringify( MinimumCommitment$outboundSchema.parse(minimumCommitment), ); } export function minimumCommitmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MinimumCommitment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MinimumCommitment' from JSON`, ); }