/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type LinkedPaymentAllocations = { /** * ID of the payment */ id?: string | undefined; /** * Amount of the payment allocated to the bill */ allocatedAmount?: number | null | undefined; /** * Date of the payment */ date?: Date | null | undefined; }; /** @internal */ export const LinkedPaymentAllocations$inboundSchema: z.ZodType< LinkedPaymentAllocations, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ id: types.optional(types.string()), allocated_amount: z.nullable(types.number()).optional(), date: z.nullable(types.date()).optional(), }).transform((v) => { return remap$(v, { "allocated_amount": "allocatedAmount", }); }) ); /** @internal */ export type LinkedPaymentAllocations$Outbound = { id?: string | undefined; allocated_amount?: number | null | undefined; date?: string | null | undefined; }; /** @internal */ export const LinkedPaymentAllocations$outboundSchema: z.ZodType< LinkedPaymentAllocations$Outbound, z.ZodTypeDef, LinkedPaymentAllocations > = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.string().optional(), allocatedAmount: z.nullable(z.number()).optional(), date: z.nullable(z.date().transform(v => v.toISOString())).optional(), }).transform((v) => { return remap$(v, { allocatedAmount: "allocated_amount", }); }) ); export function linkedPaymentAllocationsToJSON( linkedPaymentAllocations: LinkedPaymentAllocations, ): string { return JSON.stringify( LinkedPaymentAllocations$outboundSchema.parse(linkedPaymentAllocations), ); } export function linkedPaymentAllocationsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LinkedPaymentAllocations$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LinkedPaymentAllocations' from JSON`, ); }