/* * 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"; export type AmountDecimal = { /** * 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 AmountDecimal$inboundSchema: z.ZodType< AmountDecimal, z.ZodTypeDef, unknown > = z.object({ currency: z.string(), valueDecimal: z.string(), }); /** @internal */ export type AmountDecimal$Outbound = { currency: string; valueDecimal: string; }; /** @internal */ export const AmountDecimal$outboundSchema: z.ZodType< AmountDecimal$Outbound, z.ZodTypeDef, AmountDecimal > = z.object({ currency: z.string(), valueDecimal: z.string(), }); export function amountDecimalToJSON(amountDecimal: AmountDecimal): string { return JSON.stringify(AmountDecimal$outboundSchema.parse(amountDecimal)); } export function amountDecimalFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AmountDecimal$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AmountDecimal' from JSON`, ); }