/* * 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"; /** * Retirement distribution type */ export enum DistributionConstraintsDistributionTypeInfoType { 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", } /** * Retirement distribution type */ export type DistributionConstraintsDistributionTypeInfoTypeOpen = OpenEnum< typeof DistributionConstraintsDistributionTypeInfoType >; /** * Retirement distribution type info */ export type DistributionConstraintsDistributionTypeInfo = { /** * Whether federal withholding is enabled */ federalWithholdingEnabled?: boolean | undefined; /** * Whether state withholding is enabled */ stateWithholdingEnabled?: boolean | undefined; /** * Retirement distribution type */ type?: DistributionConstraintsDistributionTypeInfoTypeOpen | undefined; }; /** @internal */ export const DistributionConstraintsDistributionTypeInfoType$inboundSchema: z.ZodType< DistributionConstraintsDistributionTypeInfoTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(DistributionConstraintsDistributionTypeInfoType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const DistributionConstraintsDistributionTypeInfoType$outboundSchema: z.ZodType< DistributionConstraintsDistributionTypeInfoTypeOpen, z.ZodTypeDef, DistributionConstraintsDistributionTypeInfoTypeOpen > = z.union([ z.nativeEnum(DistributionConstraintsDistributionTypeInfoType), 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 DistributionConstraintsDistributionTypeInfoType$ { /** @deprecated use `DistributionConstraintsDistributionTypeInfoType$inboundSchema` instead. */ export const inboundSchema = DistributionConstraintsDistributionTypeInfoType$inboundSchema; /** @deprecated use `DistributionConstraintsDistributionTypeInfoType$outboundSchema` instead. */ export const outboundSchema = DistributionConstraintsDistributionTypeInfoType$outboundSchema; } /** @internal */ export const DistributionConstraintsDistributionTypeInfo$inboundSchema: z.ZodType< DistributionConstraintsDistributionTypeInfo, z.ZodTypeDef, unknown > = z.object({ federal_withholding_enabled: z.boolean().optional(), state_withholding_enabled: z.boolean().optional(), type: DistributionConstraintsDistributionTypeInfoType$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "federal_withholding_enabled": "federalWithholdingEnabled", "state_withholding_enabled": "stateWithholdingEnabled", }); }); /** @internal */ export type DistributionConstraintsDistributionTypeInfo$Outbound = { federal_withholding_enabled?: boolean | undefined; state_withholding_enabled?: boolean | undefined; type?: string | undefined; }; /** @internal */ export const DistributionConstraintsDistributionTypeInfo$outboundSchema: z.ZodType< DistributionConstraintsDistributionTypeInfo$Outbound, z.ZodTypeDef, DistributionConstraintsDistributionTypeInfo > = z.object({ federalWithholdingEnabled: z.boolean().optional(), stateWithholdingEnabled: z.boolean().optional(), type: DistributionConstraintsDistributionTypeInfoType$outboundSchema .optional(), }).transform((v) => { return remap$(v, { federalWithholdingEnabled: "federal_withholding_enabled", stateWithholdingEnabled: "state_withholding_enabled", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DistributionConstraintsDistributionTypeInfo$ { /** @deprecated use `DistributionConstraintsDistributionTypeInfo$inboundSchema` instead. */ export const inboundSchema = DistributionConstraintsDistributionTypeInfo$inboundSchema; /** @deprecated use `DistributionConstraintsDistributionTypeInfo$outboundSchema` instead. */ export const outboundSchema = DistributionConstraintsDistributionTypeInfo$outboundSchema; /** @deprecated use `DistributionConstraintsDistributionTypeInfo$Outbound` instead. */ export type Outbound = DistributionConstraintsDistributionTypeInfo$Outbound; } export function distributionConstraintsDistributionTypeInfoToJSON( distributionConstraintsDistributionTypeInfo: DistributionConstraintsDistributionTypeInfo, ): string { return JSON.stringify( DistributionConstraintsDistributionTypeInfo$outboundSchema.parse( distributionConstraintsDistributionTypeInfo, ), ); } export function distributionConstraintsDistributionTypeInfoFromJSON( jsonString: string, ): SafeParseResult< DistributionConstraintsDistributionTypeInfo, SDKValidationError > { return safeParse( jsonString, (x) => DistributionConstraintsDistributionTypeInfo$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'DistributionConstraintsDistributionTypeInfo' from JSON`, ); }