/* * 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 { RetirementDistributionCreate, RetirementDistributionCreate$inboundSchema, RetirementDistributionCreate$Outbound, RetirementDistributionCreate$outboundSchema, } from "./retirementdistributioncreate.js"; import { WithdrawalScheduleDetailsCreate, WithdrawalScheduleDetailsCreate$inboundSchema, WithdrawalScheduleDetailsCreate$Outbound, WithdrawalScheduleDetailsCreate$outboundSchema, } from "./withdrawalscheduledetailscreate.js"; /** * A withdrawal transfer schedule using the ACH mechanism */ export type AchWithdrawalScheduleCreate = { /** * The name of the bank relationship to be used in the ACH transaction */ bankRelationship: string; /** * A distribution from a retirement account. */ iraDistribution?: RetirementDistributionCreate | undefined; /** * Details of withdrawal schedule transfers */ scheduleDetails: WithdrawalScheduleDetailsCreate; }; /** @internal */ export const AchWithdrawalScheduleCreate$inboundSchema: z.ZodType< AchWithdrawalScheduleCreate, z.ZodTypeDef, unknown > = z.object({ bank_relationship: z.string(), ira_distribution: RetirementDistributionCreate$inboundSchema.optional(), schedule_details: WithdrawalScheduleDetailsCreate$inboundSchema, }).transform((v) => { return remap$(v, { "bank_relationship": "bankRelationship", "ira_distribution": "iraDistribution", "schedule_details": "scheduleDetails", }); }); /** @internal */ export type AchWithdrawalScheduleCreate$Outbound = { bank_relationship: string; ira_distribution?: RetirementDistributionCreate$Outbound | undefined; schedule_details: WithdrawalScheduleDetailsCreate$Outbound; }; /** @internal */ export const AchWithdrawalScheduleCreate$outboundSchema: z.ZodType< AchWithdrawalScheduleCreate$Outbound, z.ZodTypeDef, AchWithdrawalScheduleCreate > = z.object({ bankRelationship: z.string(), iraDistribution: RetirementDistributionCreate$outboundSchema.optional(), scheduleDetails: WithdrawalScheduleDetailsCreate$outboundSchema, }).transform((v) => { return remap$(v, { bankRelationship: "bank_relationship", iraDistribution: "ira_distribution", scheduleDetails: "schedule_details", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AchWithdrawalScheduleCreate$ { /** @deprecated use `AchWithdrawalScheduleCreate$inboundSchema` instead. */ export const inboundSchema = AchWithdrawalScheduleCreate$inboundSchema; /** @deprecated use `AchWithdrawalScheduleCreate$outboundSchema` instead. */ export const outboundSchema = AchWithdrawalScheduleCreate$outboundSchema; /** @deprecated use `AchWithdrawalScheduleCreate$Outbound` instead. */ export type Outbound = AchWithdrawalScheduleCreate$Outbound; } export function achWithdrawalScheduleCreateToJSON( achWithdrawalScheduleCreate: AchWithdrawalScheduleCreate, ): string { return JSON.stringify( AchWithdrawalScheduleCreate$outboundSchema.parse( achWithdrawalScheduleCreate, ), ); } export function achWithdrawalScheduleCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AchWithdrawalScheduleCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AchWithdrawalScheduleCreate' from JSON`, ); }