/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DecimalCreate, DecimalCreate$inboundSchema, DecimalCreate$Outbound, DecimalCreate$outboundSchema, } from "./decimalcreate.js"; import { SchedulePropertiesCreate, SchedulePropertiesCreate$inboundSchema, SchedulePropertiesCreate$Outbound, SchedulePropertiesCreate$outboundSchema, } from "./schedulepropertiescreate.js"; /** * Details of withdrawal schedule transfers */ export type WithdrawalScheduleDetailsCreate = { /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ amount?: DecimalCreate | undefined; /** * External identifier supplied by the API caller. Each request must have a unique pairing of client_schedule_id and account */ clientScheduleId: string; /** * Flag to indicate a full disbursement transfer (mutually exclusive with 'amount') */ fullDisbursement?: boolean | undefined; /** * Properties common to all transfer schedules */ scheduleProperties: SchedulePropertiesCreate; }; /** @internal */ export const WithdrawalScheduleDetailsCreate$inboundSchema: z.ZodType< WithdrawalScheduleDetailsCreate, z.ZodTypeDef, unknown > = z.object({ amount: DecimalCreate$inboundSchema.optional(), client_schedule_id: z.string(), full_disbursement: z.boolean().optional(), schedule_properties: SchedulePropertiesCreate$inboundSchema, }).transform((v) => { return remap$(v, { "client_schedule_id": "clientScheduleId", "full_disbursement": "fullDisbursement", "schedule_properties": "scheduleProperties", }); }); /** @internal */ export type WithdrawalScheduleDetailsCreate$Outbound = { amount?: DecimalCreate$Outbound | undefined; client_schedule_id: string; full_disbursement?: boolean | undefined; schedule_properties: SchedulePropertiesCreate$Outbound; }; /** @internal */ export const WithdrawalScheduleDetailsCreate$outboundSchema: z.ZodType< WithdrawalScheduleDetailsCreate$Outbound, z.ZodTypeDef, WithdrawalScheduleDetailsCreate > = z.object({ amount: DecimalCreate$outboundSchema.optional(), clientScheduleId: z.string(), fullDisbursement: z.boolean().optional(), scheduleProperties: SchedulePropertiesCreate$outboundSchema, }).transform((v) => { return remap$(v, { clientScheduleId: "client_schedule_id", fullDisbursement: "full_disbursement", scheduleProperties: "schedule_properties", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace WithdrawalScheduleDetailsCreate$ { /** @deprecated use `WithdrawalScheduleDetailsCreate$inboundSchema` instead. */ export const inboundSchema = WithdrawalScheduleDetailsCreate$inboundSchema; /** @deprecated use `WithdrawalScheduleDetailsCreate$outboundSchema` instead. */ export const outboundSchema = WithdrawalScheduleDetailsCreate$outboundSchema; /** @deprecated use `WithdrawalScheduleDetailsCreate$Outbound` instead. */ export type Outbound = WithdrawalScheduleDetailsCreate$Outbound; } export function withdrawalScheduleDetailsCreateToJSON( withdrawalScheduleDetailsCreate: WithdrawalScheduleDetailsCreate, ): string { return JSON.stringify( WithdrawalScheduleDetailsCreate$outboundSchema.parse( withdrawalScheduleDetailsCreate, ), ); } export function withdrawalScheduleDetailsCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WithdrawalScheduleDetailsCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WithdrawalScheduleDetailsCreate' from JSON`, ); }