/* * 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 { RetirementContributionCreate, RetirementContributionCreate$inboundSchema, RetirementContributionCreate$Outbound, RetirementContributionCreate$outboundSchema, } from "./retirementcontributioncreate.js"; import { RetirementDistributionCreate, RetirementDistributionCreate$inboundSchema, RetirementDistributionCreate$Outbound, RetirementDistributionCreate$outboundSchema, } from "./retirementdistributioncreate.js"; import { WithdrawalScheduleDetailsCreate, WithdrawalScheduleDetailsCreate$inboundSchema, WithdrawalScheduleDetailsCreate$Outbound, WithdrawalScheduleDetailsCreate$outboundSchema, } from "./withdrawalscheduledetailscreate.js"; /** * A Cash Journal transfer schedule */ export type CashJournalScheduleCreate = { /** * The destination account for the Cash Journal */ destinationAccount: string; /** * A contribution to a retirement account. */ retirementContribution?: RetirementContributionCreate | undefined; /** * A distribution from a retirement account. */ retirementDistribution?: RetirementDistributionCreate | undefined; /** * Details of withdrawal schedule transfers */ scheduleDetails: WithdrawalScheduleDetailsCreate; /** * The source account for the Cash Journal */ sourceAccount: string; }; /** @internal */ export const CashJournalScheduleCreate$inboundSchema: z.ZodType< CashJournalScheduleCreate, z.ZodTypeDef, unknown > = z.object({ destination_account: z.string(), retirement_contribution: RetirementContributionCreate$inboundSchema .optional(), retirement_distribution: RetirementDistributionCreate$inboundSchema .optional(), schedule_details: WithdrawalScheduleDetailsCreate$inboundSchema, source_account: z.string(), }).transform((v) => { return remap$(v, { "destination_account": "destinationAccount", "retirement_contribution": "retirementContribution", "retirement_distribution": "retirementDistribution", "schedule_details": "scheduleDetails", "source_account": "sourceAccount", }); }); /** @internal */ export type CashJournalScheduleCreate$Outbound = { destination_account: string; retirement_contribution?: RetirementContributionCreate$Outbound | undefined; retirement_distribution?: RetirementDistributionCreate$Outbound | undefined; schedule_details: WithdrawalScheduleDetailsCreate$Outbound; source_account: string; }; /** @internal */ export const CashJournalScheduleCreate$outboundSchema: z.ZodType< CashJournalScheduleCreate$Outbound, z.ZodTypeDef, CashJournalScheduleCreate > = z.object({ destinationAccount: z.string(), retirementContribution: RetirementContributionCreate$outboundSchema .optional(), retirementDistribution: RetirementDistributionCreate$outboundSchema .optional(), scheduleDetails: WithdrawalScheduleDetailsCreate$outboundSchema, sourceAccount: z.string(), }).transform((v) => { return remap$(v, { destinationAccount: "destination_account", retirementContribution: "retirement_contribution", retirementDistribution: "retirement_distribution", scheduleDetails: "schedule_details", sourceAccount: "source_account", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CashJournalScheduleCreate$ { /** @deprecated use `CashJournalScheduleCreate$inboundSchema` instead. */ export const inboundSchema = CashJournalScheduleCreate$inboundSchema; /** @deprecated use `CashJournalScheduleCreate$outboundSchema` instead. */ export const outboundSchema = CashJournalScheduleCreate$outboundSchema; /** @deprecated use `CashJournalScheduleCreate$Outbound` instead. */ export type Outbound = CashJournalScheduleCreate$Outbound; } export function cashJournalScheduleCreateToJSON( cashJournalScheduleCreate: CashJournalScheduleCreate, ): string { return JSON.stringify( CashJournalScheduleCreate$outboundSchema.parse(cashJournalScheduleCreate), ); } export function cashJournalScheduleCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CashJournalScheduleCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CashJournalScheduleCreate' from JSON`, ); }