/* * 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"; /** * The amount to withdraw in USD. The value should not be set if the withdrawal is `full_disbursement`. */ export type AchWithdrawalAmount = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * Fixed USD amount to withhold for taxes. */ export type AchWithdrawalRetirementDistributionAmount = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * Percentage of total disbursement amount to withhold for taxes. */ export type AchWithdrawalPercentage = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * The federal tax withholding. */ export type FederalTaxWithholding = { /** * Fixed USD amount to withhold for taxes. */ amount?: AchWithdrawalRetirementDistributionAmount | null | undefined; /** * Percentage of total disbursement amount to withhold for taxes. */ percentage?: AchWithdrawalPercentage | null | undefined; }; /** * Fixed USD amount to withhold for taxes. */ export type AchWithdrawalRetirementDistributionStateTaxWithholdingAmount = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * Percentage of total disbursement amount to withhold for taxes. */ export type AchWithdrawalRetirementDistributionPercentage = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * The state tax withholding. */ export type StateTaxWithholding = { /** * Fixed USD amount to withhold for taxes. */ amount?: | AchWithdrawalRetirementDistributionStateTaxWithholdingAmount | null | undefined; /** * Percentage of total disbursement amount to withhold for taxes. */ percentage?: AchWithdrawalRetirementDistributionPercentage | null | undefined; }; /** * The type of retirement distribution. */ export enum AchWithdrawalType { TypeUnspecified = "TYPE_UNSPECIFIED", Normal = "NORMAL", Disability = "DISABILITY", Sosepp = "SOSEPP", Premature = "PREMATURE", Death = "DEATH", ExcessContributionRemovalBeforeTaxDeadline = "EXCESS_CONTRIBUTION_REMOVAL_BEFORE_TAX_DEADLINE", ExcessContributionRemovalAfterTaxDeadline = "EXCESS_CONTRIBUTION_REMOVAL_AFTER_TAX_DEADLINE", RolloverToQualifiedPlan = "ROLLOVER_TO_QUALIFIED_PLAN", RolloverToIra = "ROLLOVER_TO_IRA", DistributionTransfer = "DISTRIBUTION_TRANSFER", RecharacterizationPriorYear = "RECHARACTERIZATION_PRIOR_YEAR", RecharacterizationCurrentYear = "RECHARACTERIZATION_CURRENT_YEAR", DistributionConversion = "DISTRIBUTION_CONVERSION", ManagementFee = "MANAGEMENT_FEE", PlanLoan401K = "PLAN_LOAN_401K", PrematureSimpleIraLessThan2Years = "PREMATURE_SIMPLE_IRA_LESS_THAN_2_YEARS", NormalRothIraGreaterThan5Years = "NORMAL_ROTH_IRA_GREATER_THAN_5_YEARS", NetIncomeAttributable = "NET_INCOME_ATTRIBUTABLE", Revocation = "REVOCATION", NonReportable = "NON_REPORTABLE", QualifiedCharitableDistribution = "QUALIFIED_CHARITABLE_DISTRIBUTION", } /** * The type of retirement distribution. */ export type AchWithdrawalTypeOpen = OpenEnum; /** * The retirement distribution details. */ export type RetirementDistribution = { /** * The federal tax withholding. */ federalTaxWithholding?: FederalTaxWithholding | null | undefined; /** * The institution receiving retirement funds when performing a transfer to an identical retirement account type at a different financial institution. This is required for check and wire withdrawals because we can't always identify the institution using the transfer instructions. For cash journals this value will default to "Apex Clearing", regardless of what is passed in here */ receivingInstitution?: string | undefined; /** * The state tax withholding. */ stateTaxWithholding?: StateTaxWithholding | null | undefined; /** * Whether or not this distribution has a state withholding waiver. */ stateWithholdingWaiver?: boolean | undefined; /** * Tax year for which the distribution is applied. */ taxYear?: number | undefined; /** * The type of retirement distribution. */ type?: AchWithdrawalTypeOpen | undefined; }; /** * The high level state of a transfer, one of: * * @remarks * - `PROCESSING` - The transfer is being processed and will be posted if successful. * - `PENDING_REVIEW` - The transfer is pending review and will continue processing if approved. * - `POSTED` - The transfer has been posted to the ledger and will be completed at the end of the processing window if not canceled first. * - `COMPLETED` - The transfer has been batched and completed. * - `REJECTED` - The transfer was rejected. * - `CANCELED` - The transfer was canceled. * - `RETURNED` - The transfer was returned. * - `POSTPONED` - The transfer is postponed and will resume processing during the next processing window. */ export enum AchWithdrawalStateState { StateUnspecified = "STATE_UNSPECIFIED", Processing = "PROCESSING", PendingReview = "PENDING_REVIEW", Posted = "POSTED", Completed = "COMPLETED", Rejected = "REJECTED", Canceled = "CANCELED", Returned = "RETURNED", Postponed = "POSTPONED", } /** * The high level state of a transfer, one of: * * @remarks * - `PROCESSING` - The transfer is being processed and will be posted if successful. * - `PENDING_REVIEW` - The transfer is pending review and will continue processing if approved. * - `POSTED` - The transfer has been posted to the ledger and will be completed at the end of the processing window if not canceled first. * - `COMPLETED` - The transfer has been batched and completed. * - `REJECTED` - The transfer was rejected. * - `CANCELED` - The transfer was canceled. * - `RETURNED` - The transfer was returned. * - `POSTPONED` - The transfer is postponed and will resume processing during the next processing window. */ export type AchWithdrawalStateStateOpen = OpenEnum< typeof AchWithdrawalStateState >; /** * The current state of the ACH withdrawal. */ export type AchWithdrawalState = { /** * The user or service that triggered the state update. */ actor?: string | undefined; /** * Additional description of the transfer state. */ message?: string | undefined; /** * Additional metadata relating to the transfer state. Included data depends on the state, e.g.: * * @remarks * - Rejection reasons are included when the `state` is `REJECTED` * - Reason and comment are included when `state` is `CANCELED` */ metadata?: { [k: string]: any } | null | undefined; /** * The high level state of a transfer, one of: * * @remarks * - `PROCESSING` - The transfer is being processed and will be posted if successful. * - `PENDING_REVIEW` - The transfer is pending review and will continue processing if approved. * - `POSTED` - The transfer has been posted to the ledger and will be completed at the end of the processing window if not canceled first. * - `COMPLETED` - The transfer has been batched and completed. * - `REJECTED` - The transfer was rejected. * - `CANCELED` - The transfer was canceled. * - `RETURNED` - The transfer was returned. * - `POSTPONED` - The transfer is postponed and will resume processing during the next processing window. */ state?: AchWithdrawalStateStateOpen | undefined; /** * The time of the state update. */ updateTime?: Date | null | undefined; }; /** * A withdrawal transfer using the ACH mechanism. */ export type AchWithdrawal = { /** * The amount to withdraw in USD. The value should not be set if the withdrawal is `full_disbursement`. */ amount?: AchWithdrawalAmount | null | undefined; /** * The bank relationship to be used for the ACH withdrawal. */ bankRelationship?: string | undefined; /** * The external identifier supplied by the API caller. Each request must have a unique pairing of `client_transfer_id` and `account`. */ clientTransferId?: string | undefined; /** * The memo that will appear on the customer's bank statement. */ memo?: string | undefined; /** * The resource name of the ACH withdrawal. */ name?: string | undefined; /** * The retirement distribution details. */ retirementDistribution?: RetirementDistribution | null | undefined; /** * The current state of the ACH withdrawal. */ state?: AchWithdrawalState | null | undefined; }; /** @internal */ export const AchWithdrawalAmount$inboundSchema: z.ZodType< AchWithdrawalAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type AchWithdrawalAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const AchWithdrawalAmount$outboundSchema: z.ZodType< AchWithdrawalAmount$Outbound, z.ZodTypeDef, AchWithdrawalAmount > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AchWithdrawalAmount$ { /** @deprecated use `AchWithdrawalAmount$inboundSchema` instead. */ export const inboundSchema = AchWithdrawalAmount$inboundSchema; /** @deprecated use `AchWithdrawalAmount$outboundSchema` instead. */ export const outboundSchema = AchWithdrawalAmount$outboundSchema; /** @deprecated use `AchWithdrawalAmount$Outbound` instead. */ export type Outbound = AchWithdrawalAmount$Outbound; } export function achWithdrawalAmountToJSON( achWithdrawalAmount: AchWithdrawalAmount, ): string { return JSON.stringify( AchWithdrawalAmount$outboundSchema.parse(achWithdrawalAmount), ); } export function achWithdrawalAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AchWithdrawalAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AchWithdrawalAmount' from JSON`, ); } /** @internal */ export const AchWithdrawalRetirementDistributionAmount$inboundSchema: z.ZodType< AchWithdrawalRetirementDistributionAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type AchWithdrawalRetirementDistributionAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const AchWithdrawalRetirementDistributionAmount$outboundSchema: z.ZodType< AchWithdrawalRetirementDistributionAmount$Outbound, z.ZodTypeDef, AchWithdrawalRetirementDistributionAmount > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AchWithdrawalRetirementDistributionAmount$ { /** @deprecated use `AchWithdrawalRetirementDistributionAmount$inboundSchema` instead. */ export const inboundSchema = AchWithdrawalRetirementDistributionAmount$inboundSchema; /** @deprecated use `AchWithdrawalRetirementDistributionAmount$outboundSchema` instead. */ export const outboundSchema = AchWithdrawalRetirementDistributionAmount$outboundSchema; /** @deprecated use `AchWithdrawalRetirementDistributionAmount$Outbound` instead. */ export type Outbound = AchWithdrawalRetirementDistributionAmount$Outbound; } export function achWithdrawalRetirementDistributionAmountToJSON( achWithdrawalRetirementDistributionAmount: AchWithdrawalRetirementDistributionAmount, ): string { return JSON.stringify( AchWithdrawalRetirementDistributionAmount$outboundSchema.parse( achWithdrawalRetirementDistributionAmount, ), ); } export function achWithdrawalRetirementDistributionAmountFromJSON( jsonString: string, ): SafeParseResult< AchWithdrawalRetirementDistributionAmount, SDKValidationError > { return safeParse( jsonString, (x) => AchWithdrawalRetirementDistributionAmount$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'AchWithdrawalRetirementDistributionAmount' from JSON`, ); } /** @internal */ export const AchWithdrawalPercentage$inboundSchema: z.ZodType< AchWithdrawalPercentage, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type AchWithdrawalPercentage$Outbound = { value?: string | undefined; }; /** @internal */ export const AchWithdrawalPercentage$outboundSchema: z.ZodType< AchWithdrawalPercentage$Outbound, z.ZodTypeDef, AchWithdrawalPercentage > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AchWithdrawalPercentage$ { /** @deprecated use `AchWithdrawalPercentage$inboundSchema` instead. */ export const inboundSchema = AchWithdrawalPercentage$inboundSchema; /** @deprecated use `AchWithdrawalPercentage$outboundSchema` instead. */ export const outboundSchema = AchWithdrawalPercentage$outboundSchema; /** @deprecated use `AchWithdrawalPercentage$Outbound` instead. */ export type Outbound = AchWithdrawalPercentage$Outbound; } export function achWithdrawalPercentageToJSON( achWithdrawalPercentage: AchWithdrawalPercentage, ): string { return JSON.stringify( AchWithdrawalPercentage$outboundSchema.parse(achWithdrawalPercentage), ); } export function achWithdrawalPercentageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AchWithdrawalPercentage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AchWithdrawalPercentage' from JSON`, ); } /** @internal */ export const FederalTaxWithholding$inboundSchema: z.ZodType< FederalTaxWithholding, z.ZodTypeDef, unknown > = z.object({ amount: z.nullable( z.lazy(() => AchWithdrawalRetirementDistributionAmount$inboundSchema), ).optional(), percentage: z.nullable(z.lazy(() => AchWithdrawalPercentage$inboundSchema)) .optional(), }); /** @internal */ export type FederalTaxWithholding$Outbound = { amount?: | AchWithdrawalRetirementDistributionAmount$Outbound | null | undefined; percentage?: AchWithdrawalPercentage$Outbound | null | undefined; }; /** @internal */ export const FederalTaxWithholding$outboundSchema: z.ZodType< FederalTaxWithholding$Outbound, z.ZodTypeDef, FederalTaxWithholding > = z.object({ amount: z.nullable( z.lazy(() => AchWithdrawalRetirementDistributionAmount$outboundSchema), ).optional(), percentage: z.nullable(z.lazy(() => AchWithdrawalPercentage$outboundSchema)) .optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace FederalTaxWithholding$ { /** @deprecated use `FederalTaxWithholding$inboundSchema` instead. */ export const inboundSchema = FederalTaxWithholding$inboundSchema; /** @deprecated use `FederalTaxWithholding$outboundSchema` instead. */ export const outboundSchema = FederalTaxWithholding$outboundSchema; /** @deprecated use `FederalTaxWithholding$Outbound` instead. */ export type Outbound = FederalTaxWithholding$Outbound; } export function federalTaxWithholdingToJSON( federalTaxWithholding: FederalTaxWithholding, ): string { return JSON.stringify( FederalTaxWithholding$outboundSchema.parse(federalTaxWithholding), ); } export function federalTaxWithholdingFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FederalTaxWithholding$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FederalTaxWithholding' from JSON`, ); } /** @internal */ export const AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$inboundSchema: z.ZodType< AchWithdrawalRetirementDistributionStateTaxWithholdingAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$outboundSchema: z.ZodType< AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$Outbound, z.ZodTypeDef, AchWithdrawalRetirementDistributionStateTaxWithholdingAmount > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$ { /** @deprecated use `AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$inboundSchema` instead. */ export const inboundSchema = AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$inboundSchema; /** @deprecated use `AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$outboundSchema` instead. */ export const outboundSchema = AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$outboundSchema; /** @deprecated use `AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$Outbound` instead. */ export type Outbound = AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$Outbound; } export function achWithdrawalRetirementDistributionStateTaxWithholdingAmountToJSON( achWithdrawalRetirementDistributionStateTaxWithholdingAmount: AchWithdrawalRetirementDistributionStateTaxWithholdingAmount, ): string { return JSON.stringify( AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$outboundSchema .parse(achWithdrawalRetirementDistributionStateTaxWithholdingAmount), ); } export function achWithdrawalRetirementDistributionStateTaxWithholdingAmountFromJSON( jsonString: string, ): SafeParseResult< AchWithdrawalRetirementDistributionStateTaxWithholdingAmount, SDKValidationError > { return safeParse( jsonString, (x) => AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'AchWithdrawalRetirementDistributionStateTaxWithholdingAmount' from JSON`, ); } /** @internal */ export const AchWithdrawalRetirementDistributionPercentage$inboundSchema: z.ZodType< AchWithdrawalRetirementDistributionPercentage, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type AchWithdrawalRetirementDistributionPercentage$Outbound = { value?: string | undefined; }; /** @internal */ export const AchWithdrawalRetirementDistributionPercentage$outboundSchema: z.ZodType< AchWithdrawalRetirementDistributionPercentage$Outbound, z.ZodTypeDef, AchWithdrawalRetirementDistributionPercentage > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AchWithdrawalRetirementDistributionPercentage$ { /** @deprecated use `AchWithdrawalRetirementDistributionPercentage$inboundSchema` instead. */ export const inboundSchema = AchWithdrawalRetirementDistributionPercentage$inboundSchema; /** @deprecated use `AchWithdrawalRetirementDistributionPercentage$outboundSchema` instead. */ export const outboundSchema = AchWithdrawalRetirementDistributionPercentage$outboundSchema; /** @deprecated use `AchWithdrawalRetirementDistributionPercentage$Outbound` instead. */ export type Outbound = AchWithdrawalRetirementDistributionPercentage$Outbound; } export function achWithdrawalRetirementDistributionPercentageToJSON( achWithdrawalRetirementDistributionPercentage: AchWithdrawalRetirementDistributionPercentage, ): string { return JSON.stringify( AchWithdrawalRetirementDistributionPercentage$outboundSchema.parse( achWithdrawalRetirementDistributionPercentage, ), ); } export function achWithdrawalRetirementDistributionPercentageFromJSON( jsonString: string, ): SafeParseResult< AchWithdrawalRetirementDistributionPercentage, SDKValidationError > { return safeParse( jsonString, (x) => AchWithdrawalRetirementDistributionPercentage$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'AchWithdrawalRetirementDistributionPercentage' from JSON`, ); } /** @internal */ export const StateTaxWithholding$inboundSchema: z.ZodType< StateTaxWithholding, z.ZodTypeDef, unknown > = z.object({ amount: z.nullable( z.lazy(() => AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$inboundSchema ), ).optional(), percentage: z.nullable( z.lazy(() => AchWithdrawalRetirementDistributionPercentage$inboundSchema), ).optional(), }); /** @internal */ export type StateTaxWithholding$Outbound = { amount?: | AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$Outbound | null | undefined; percentage?: | AchWithdrawalRetirementDistributionPercentage$Outbound | null | undefined; }; /** @internal */ export const StateTaxWithholding$outboundSchema: z.ZodType< StateTaxWithholding$Outbound, z.ZodTypeDef, StateTaxWithholding > = z.object({ amount: z.nullable( z.lazy(() => AchWithdrawalRetirementDistributionStateTaxWithholdingAmount$outboundSchema ), ).optional(), percentage: z.nullable( z.lazy(() => AchWithdrawalRetirementDistributionPercentage$outboundSchema), ).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace StateTaxWithholding$ { /** @deprecated use `StateTaxWithholding$inboundSchema` instead. */ export const inboundSchema = StateTaxWithholding$inboundSchema; /** @deprecated use `StateTaxWithholding$outboundSchema` instead. */ export const outboundSchema = StateTaxWithholding$outboundSchema; /** @deprecated use `StateTaxWithholding$Outbound` instead. */ export type Outbound = StateTaxWithholding$Outbound; } export function stateTaxWithholdingToJSON( stateTaxWithholding: StateTaxWithholding, ): string { return JSON.stringify( StateTaxWithholding$outboundSchema.parse(stateTaxWithholding), ); } export function stateTaxWithholdingFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => StateTaxWithholding$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'StateTaxWithholding' from JSON`, ); } /** @internal */ export const AchWithdrawalType$inboundSchema: z.ZodType< AchWithdrawalTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AchWithdrawalType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AchWithdrawalType$outboundSchema: z.ZodType< AchWithdrawalTypeOpen, z.ZodTypeDef, AchWithdrawalTypeOpen > = z.union([ z.nativeEnum(AchWithdrawalType), 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 AchWithdrawalType$ { /** @deprecated use `AchWithdrawalType$inboundSchema` instead. */ export const inboundSchema = AchWithdrawalType$inboundSchema; /** @deprecated use `AchWithdrawalType$outboundSchema` instead. */ export const outboundSchema = AchWithdrawalType$outboundSchema; } /** @internal */ export const RetirementDistribution$inboundSchema: z.ZodType< RetirementDistribution, z.ZodTypeDef, unknown > = z.object({ federal_tax_withholding: z.nullable( z.lazy(() => FederalTaxWithholding$inboundSchema), ).optional(), receiving_institution: z.string().optional(), state_tax_withholding: z.nullable( z.lazy(() => StateTaxWithholding$inboundSchema), ).optional(), state_withholding_waiver: z.boolean().optional(), tax_year: z.number().int().optional(), type: AchWithdrawalType$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "federal_tax_withholding": "federalTaxWithholding", "receiving_institution": "receivingInstitution", "state_tax_withholding": "stateTaxWithholding", "state_withholding_waiver": "stateWithholdingWaiver", "tax_year": "taxYear", }); }); /** @internal */ export type RetirementDistribution$Outbound = { federal_tax_withholding?: FederalTaxWithholding$Outbound | null | undefined; receiving_institution?: string | undefined; state_tax_withholding?: StateTaxWithholding$Outbound | null | undefined; state_withholding_waiver?: boolean | undefined; tax_year?: number | undefined; type?: string | undefined; }; /** @internal */ export const RetirementDistribution$outboundSchema: z.ZodType< RetirementDistribution$Outbound, z.ZodTypeDef, RetirementDistribution > = z.object({ federalTaxWithholding: z.nullable( z.lazy(() => FederalTaxWithholding$outboundSchema), ).optional(), receivingInstitution: z.string().optional(), stateTaxWithholding: z.nullable( z.lazy(() => StateTaxWithholding$outboundSchema), ).optional(), stateWithholdingWaiver: z.boolean().optional(), taxYear: z.number().int().optional(), type: AchWithdrawalType$outboundSchema.optional(), }).transform((v) => { return remap$(v, { federalTaxWithholding: "federal_tax_withholding", receivingInstitution: "receiving_institution", stateTaxWithholding: "state_tax_withholding", stateWithholdingWaiver: "state_withholding_waiver", taxYear: "tax_year", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RetirementDistribution$ { /** @deprecated use `RetirementDistribution$inboundSchema` instead. */ export const inboundSchema = RetirementDistribution$inboundSchema; /** @deprecated use `RetirementDistribution$outboundSchema` instead. */ export const outboundSchema = RetirementDistribution$outboundSchema; /** @deprecated use `RetirementDistribution$Outbound` instead. */ export type Outbound = RetirementDistribution$Outbound; } export function retirementDistributionToJSON( retirementDistribution: RetirementDistribution, ): string { return JSON.stringify( RetirementDistribution$outboundSchema.parse(retirementDistribution), ); } export function retirementDistributionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RetirementDistribution$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RetirementDistribution' from JSON`, ); } /** @internal */ export const AchWithdrawalStateState$inboundSchema: z.ZodType< AchWithdrawalStateStateOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AchWithdrawalStateState), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AchWithdrawalStateState$outboundSchema: z.ZodType< AchWithdrawalStateStateOpen, z.ZodTypeDef, AchWithdrawalStateStateOpen > = z.union([ z.nativeEnum(AchWithdrawalStateState), 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 AchWithdrawalStateState$ { /** @deprecated use `AchWithdrawalStateState$inboundSchema` instead. */ export const inboundSchema = AchWithdrawalStateState$inboundSchema; /** @deprecated use `AchWithdrawalStateState$outboundSchema` instead. */ export const outboundSchema = AchWithdrawalStateState$outboundSchema; } /** @internal */ export const AchWithdrawalState$inboundSchema: z.ZodType< AchWithdrawalState, z.ZodTypeDef, unknown > = z.object({ actor: z.string().optional(), message: z.string().optional(), metadata: z.nullable(z.record(z.any())).optional(), state: AchWithdrawalStateState$inboundSchema.optional(), update_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), }).transform((v) => { return remap$(v, { "update_time": "updateTime", }); }); /** @internal */ export type AchWithdrawalState$Outbound = { actor?: string | undefined; message?: string | undefined; metadata?: { [k: string]: any } | null | undefined; state?: string | undefined; update_time?: string | null | undefined; }; /** @internal */ export const AchWithdrawalState$outboundSchema: z.ZodType< AchWithdrawalState$Outbound, z.ZodTypeDef, AchWithdrawalState > = z.object({ actor: z.string().optional(), message: z.string().optional(), metadata: z.nullable(z.record(z.any())).optional(), state: AchWithdrawalStateState$outboundSchema.optional(), updateTime: z.nullable(z.date().transform(v => v.toISOString())).optional(), }).transform((v) => { return remap$(v, { updateTime: "update_time", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AchWithdrawalState$ { /** @deprecated use `AchWithdrawalState$inboundSchema` instead. */ export const inboundSchema = AchWithdrawalState$inboundSchema; /** @deprecated use `AchWithdrawalState$outboundSchema` instead. */ export const outboundSchema = AchWithdrawalState$outboundSchema; /** @deprecated use `AchWithdrawalState$Outbound` instead. */ export type Outbound = AchWithdrawalState$Outbound; } export function achWithdrawalStateToJSON( achWithdrawalState: AchWithdrawalState, ): string { return JSON.stringify( AchWithdrawalState$outboundSchema.parse(achWithdrawalState), ); } export function achWithdrawalStateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AchWithdrawalState$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AchWithdrawalState' from JSON`, ); } /** @internal */ export const AchWithdrawal$inboundSchema: z.ZodType< AchWithdrawal, z.ZodTypeDef, unknown > = z.object({ amount: z.nullable(z.lazy(() => AchWithdrawalAmount$inboundSchema)) .optional(), bank_relationship: z.string().optional(), client_transfer_id: z.string().optional(), memo: z.string().optional(), name: z.string().optional(), retirement_distribution: z.nullable( z.lazy(() => RetirementDistribution$inboundSchema), ).optional(), state: z.nullable(z.lazy(() => AchWithdrawalState$inboundSchema)).optional(), }).transform((v) => { return remap$(v, { "bank_relationship": "bankRelationship", "client_transfer_id": "clientTransferId", "retirement_distribution": "retirementDistribution", }); }); /** @internal */ export type AchWithdrawal$Outbound = { amount?: AchWithdrawalAmount$Outbound | null | undefined; bank_relationship?: string | undefined; client_transfer_id?: string | undefined; memo?: string | undefined; name?: string | undefined; retirement_distribution?: RetirementDistribution$Outbound | null | undefined; state?: AchWithdrawalState$Outbound | null | undefined; }; /** @internal */ export const AchWithdrawal$outboundSchema: z.ZodType< AchWithdrawal$Outbound, z.ZodTypeDef, AchWithdrawal > = z.object({ amount: z.nullable(z.lazy(() => AchWithdrawalAmount$outboundSchema)) .optional(), bankRelationship: z.string().optional(), clientTransferId: z.string().optional(), memo: z.string().optional(), name: z.string().optional(), retirementDistribution: z.nullable( z.lazy(() => RetirementDistribution$outboundSchema), ).optional(), state: z.nullable(z.lazy(() => AchWithdrawalState$outboundSchema)).optional(), }).transform((v) => { return remap$(v, { bankRelationship: "bank_relationship", clientTransferId: "client_transfer_id", retirementDistribution: "retirement_distribution", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AchWithdrawal$ { /** @deprecated use `AchWithdrawal$inboundSchema` instead. */ export const inboundSchema = AchWithdrawal$inboundSchema; /** @deprecated use `AchWithdrawal$outboundSchema` instead. */ export const outboundSchema = AchWithdrawal$outboundSchema; /** @deprecated use `AchWithdrawal$Outbound` instead. */ export type Outbound = AchWithdrawal$Outbound; } export function achWithdrawalToJSON(achWithdrawal: AchWithdrawal): string { return JSON.stringify(AchWithdrawal$outboundSchema.parse(achWithdrawal)); } export function achWithdrawalFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AchWithdrawal$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AchWithdrawal' from JSON`, ); }