/* * 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 { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.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 { TransfersBeneficiaryCreate, TransfersBeneficiaryCreate$inboundSchema, TransfersBeneficiaryCreate$Outbound, TransfersBeneficiaryCreate$outboundSchema, } from "./transfersbeneficiarycreate.js"; import { WithdrawalScheduleDetailsCreate, WithdrawalScheduleDetailsCreate$inboundSchema, WithdrawalScheduleDetailsCreate$Outbound, WithdrawalScheduleDetailsCreate$outboundSchema, } from "./withdrawalscheduledetailscreate.js"; /** * The Delivery method of check withdrawal */ export enum DeliveryMethod { DeliveryMethodUnspecified = "DELIVERY_METHOD_UNSPECIFIED", Standard = "STANDARD", Overnight = "OVERNIGHT", OvernightToApex = "OVERNIGHT_TO_APEX", } /** * The Delivery method of check withdrawal */ export type DeliveryMethodOpen = OpenEnum; /** * A withdrawal transfer schedule using the Check mechanism */ export type CheckWithdrawalScheduleCreate = { /** * A Check Beneficiary */ beneficiary?: TransfersBeneficiaryCreate | undefined; /** * The Delivery method of check withdrawal */ deliveryMethod: DeliveryMethodOpen; /** * Memos on the check. The max number of lines is 3, with max of 30 characters per line */ memos?: Array | undefined; /** * A distribution from a retirement account. */ retirementDistribution?: RetirementDistributionCreate | undefined; /** * Details of withdrawal schedule transfers */ scheduleDetails: WithdrawalScheduleDetailsCreate; }; /** @internal */ export const DeliveryMethod$inboundSchema: z.ZodType< DeliveryMethodOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(DeliveryMethod), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const DeliveryMethod$outboundSchema: z.ZodType< DeliveryMethodOpen, z.ZodTypeDef, DeliveryMethodOpen > = z.union([ z.nativeEnum(DeliveryMethod), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DeliveryMethod$ { /** @deprecated use `DeliveryMethod$inboundSchema` instead. */ export const inboundSchema = DeliveryMethod$inboundSchema; /** @deprecated use `DeliveryMethod$outboundSchema` instead. */ export const outboundSchema = DeliveryMethod$outboundSchema; } /** @internal */ export const CheckWithdrawalScheduleCreate$inboundSchema: z.ZodType< CheckWithdrawalScheduleCreate, z.ZodTypeDef, unknown > = z.object({ beneficiary: TransfersBeneficiaryCreate$inboundSchema.optional(), delivery_method: DeliveryMethod$inboundSchema, memos: z.array(z.string()).optional(), retirement_distribution: RetirementDistributionCreate$inboundSchema .optional(), schedule_details: WithdrawalScheduleDetailsCreate$inboundSchema, }).transform((v) => { return remap$(v, { "delivery_method": "deliveryMethod", "retirement_distribution": "retirementDistribution", "schedule_details": "scheduleDetails", }); }); /** @internal */ export type CheckWithdrawalScheduleCreate$Outbound = { beneficiary?: TransfersBeneficiaryCreate$Outbound | undefined; delivery_method: string; memos?: Array | undefined; retirement_distribution?: RetirementDistributionCreate$Outbound | undefined; schedule_details: WithdrawalScheduleDetailsCreate$Outbound; }; /** @internal */ export const CheckWithdrawalScheduleCreate$outboundSchema: z.ZodType< CheckWithdrawalScheduleCreate$Outbound, z.ZodTypeDef, CheckWithdrawalScheduleCreate > = z.object({ beneficiary: TransfersBeneficiaryCreate$outboundSchema.optional(), deliveryMethod: DeliveryMethod$outboundSchema, memos: z.array(z.string()).optional(), retirementDistribution: RetirementDistributionCreate$outboundSchema .optional(), scheduleDetails: WithdrawalScheduleDetailsCreate$outboundSchema, }).transform((v) => { return remap$(v, { deliveryMethod: "delivery_method", retirementDistribution: "retirement_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 CheckWithdrawalScheduleCreate$ { /** @deprecated use `CheckWithdrawalScheduleCreate$inboundSchema` instead. */ export const inboundSchema = CheckWithdrawalScheduleCreate$inboundSchema; /** @deprecated use `CheckWithdrawalScheduleCreate$outboundSchema` instead. */ export const outboundSchema = CheckWithdrawalScheduleCreate$outboundSchema; /** @deprecated use `CheckWithdrawalScheduleCreate$Outbound` instead. */ export type Outbound = CheckWithdrawalScheduleCreate$Outbound; } export function checkWithdrawalScheduleCreateToJSON( checkWithdrawalScheduleCreate: CheckWithdrawalScheduleCreate, ): string { return JSON.stringify( CheckWithdrawalScheduleCreate$outboundSchema.parse( checkWithdrawalScheduleCreate, ), ); } export function checkWithdrawalScheduleCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CheckWithdrawalScheduleCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CheckWithdrawalScheduleCreate' from JSON`, ); }