/* * 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 { BalanceByTransaction, BalanceByTransaction$inboundSchema, } from "./balancebytransaction.js"; export type BalanceByPeriod = { /** * The starting date of the period. If not provided, it represents the oldest period, where all transactions due before the specified `end_date` are included. */ startDate?: Date | null | undefined; /** * The ending date of the period. If not provided, it represents an open-ended period starting from the `start_date`, typically capturing future-dated transactions that are not yet aged. */ endDate?: Date | null | undefined; /** * Total amount of the period. */ totalAmount?: number | undefined; balancesByTransaction?: Array | undefined; }; /** @internal */ export const BalanceByPeriod$inboundSchema: z.ZodType< BalanceByPeriod, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ start_date: z.nullable(types.date()).optional(), end_date: z.nullable(types.date()).optional(), total_amount: types.optional(types.number()), balances_by_transaction: types.optional( z.array(BalanceByTransaction$inboundSchema), ), }).transform((v) => { return remap$(v, { "start_date": "startDate", "end_date": "endDate", "total_amount": "totalAmount", "balances_by_transaction": "balancesByTransaction", }); }) ); export function balanceByPeriodFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BalanceByPeriod$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BalanceByPeriod' from JSON`, ); }