/* * 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 { BalanceByPeriod, BalanceByPeriod$inboundSchema, } from "./balancebyperiod.js"; import { Currency, Currency$inboundSchema } from "./currency.js"; export type OutstandingBalanceByCurrency = { /** * Indicates the associated currency for an amount of money. Values correspond to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217). */ currency?: Currency | null | undefined; /** * Total amount of the outstanding balance. */ totalAmount?: number | undefined; balancesByPeriod?: Array | undefined; }; /** @internal */ export const OutstandingBalanceByCurrency$inboundSchema: z.ZodType< OutstandingBalanceByCurrency, z.ZodTypeDef, unknown > = /* @__PURE__ */ lazySchema$(() => z.object({ currency: z.nullable(Currency$inboundSchema).optional(), total_amount: types.optional(types.number()), balances_by_period: types.optional(z.array(BalanceByPeriod$inboundSchema)), }).transform((v) => { return remap$(v, { "total_amount": "totalAmount", "balances_by_period": "balancesByPeriod", }); }) ); export function outstandingBalanceByCurrencyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OutstandingBalanceByCurrency$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutstandingBalanceByCurrency' from JSON`, ); }