/* * 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"; import { OutstandingBalanceBySupplier, OutstandingBalanceBySupplier$inboundSchema, } from "./outstandingbalancebysupplier.js"; export type AgedCreditors = { /** * The exact date and time the report was generated. */ reportGeneratedAt?: Date | undefined; /** * The cutoff date for transactions included in the report. */ reportAsOfDate?: Date | undefined; /** * Number of aging periods shown in the report. */ periodCount: number; /** * Length of each aging period in days. */ periodLength: number; outstandingBalances?: Array | undefined; }; /** @internal */ export const AgedCreditors$inboundSchema: z.ZodType< AgedCreditors, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ report_generated_at: types.optional(types.date()), report_as_of_date: types.optional(types.date()), period_count: types.number().default(4), period_length: types.number().default(30), outstanding_balances: types.optional( z.array(OutstandingBalanceBySupplier$inboundSchema), ), }).transform((v) => { return remap$(v, { "report_generated_at": "reportGeneratedAt", "report_as_of_date": "reportAsOfDate", "period_count": "periodCount", "period_length": "periodLength", "outstanding_balances": "outstandingBalances", }); }) ); export function agedCreditorsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AgedCreditors$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgedCreditors' from JSON`, ); }