/* * 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"; import { AmountDecimal, AmountDecimal$inboundSchema, AmountDecimal$Outbound, AmountDecimal$outboundSchema, } from "./amountdecimal.js"; export type BillingCountAndAmount = { /** * The number of items. */ count: number; /** * The total amount. */ amount: AmountDecimal; }; /** @internal */ export const BillingCountAndAmount$inboundSchema: z.ZodType< BillingCountAndAmount, z.ZodTypeDef, unknown > = z.object({ count: z.number().int(), amount: AmountDecimal$inboundSchema, }); /** @internal */ export type BillingCountAndAmount$Outbound = { count: number; amount: AmountDecimal$Outbound; }; /** @internal */ export const BillingCountAndAmount$outboundSchema: z.ZodType< BillingCountAndAmount$Outbound, z.ZodTypeDef, BillingCountAndAmount > = z.object({ count: z.number().int(), amount: AmountDecimal$outboundSchema, }); export function billingCountAndAmountToJSON( billingCountAndAmount: BillingCountAndAmount, ): string { return JSON.stringify( BillingCountAndAmount$outboundSchema.parse(billingCountAndAmount), ); } export function billingCountAndAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BillingCountAndAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BillingCountAndAmount' from JSON`, ); }