/* * 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"; /** * A temporal tax year value. This will always evaluate to a year based on the date the transfer was initiated. */ export enum TemporalTaxYear { TemporalTaxYearUnspecified = "TEMPORAL_TAX_YEAR_UNSPECIFIED", CurrentCalendarYear = "CURRENT_CALENDAR_YEAR", MinimumTaxYear = "MINIMUM_TAX_YEAR", } /** * A temporal tax year value. This will always evaluate to a year based on the date the transfer was initiated. */ export type TemporalTaxYearOpen = OpenEnum; /** * The type of retirement contribution. */ export enum ScheduledRetirementContributionCreateType { TypeUnspecified = "TYPE_UNSPECIFIED", Regular = "REGULAR", Employee = "EMPLOYEE", Employer = "EMPLOYER", Recharacterization = "RECHARACTERIZATION", Rollover60Day = "ROLLOVER_60_DAY", RolloverDirect = "ROLLOVER_DIRECT", Transfer = "TRANSFER", TrusteeFee = "TRUSTEE_FEE", Conversion = "CONVERSION", Repayment = "REPAYMENT", ContributionNonReportable = "CONTRIBUTION_NON_REPORTABLE", } /** * The type of retirement contribution. */ export type ScheduledRetirementContributionCreateTypeOpen = OpenEnum< typeof ScheduledRetirementContributionCreateType >; /** * The retirement contribution details for a scheduled deposit */ export type ScheduledRetirementContributionCreate = { /** * An explicit tax year value. The current year is always valid; and the prior year is valid only before the tax deadline. Must be in "YYYY" format. */ taxYear?: number | undefined; /** * A temporal tax year value. This will always evaluate to a year based on the date the transfer was initiated. */ temporalTaxYear?: TemporalTaxYearOpen | undefined; /** * The type of retirement contribution. */ type: ScheduledRetirementContributionCreateTypeOpen; }; /** @internal */ export const TemporalTaxYear$inboundSchema: z.ZodType< TemporalTaxYearOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TemporalTaxYear), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TemporalTaxYear$outboundSchema: z.ZodType< TemporalTaxYearOpen, z.ZodTypeDef, TemporalTaxYearOpen > = z.union([ z.nativeEnum(TemporalTaxYear), 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 TemporalTaxYear$ { /** @deprecated use `TemporalTaxYear$inboundSchema` instead. */ export const inboundSchema = TemporalTaxYear$inboundSchema; /** @deprecated use `TemporalTaxYear$outboundSchema` instead. */ export const outboundSchema = TemporalTaxYear$outboundSchema; } /** @internal */ export const ScheduledRetirementContributionCreateType$inboundSchema: z.ZodType< ScheduledRetirementContributionCreateTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(ScheduledRetirementContributionCreateType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const ScheduledRetirementContributionCreateType$outboundSchema: z.ZodType< ScheduledRetirementContributionCreateTypeOpen, z.ZodTypeDef, ScheduledRetirementContributionCreateTypeOpen > = z.union([ z.nativeEnum(ScheduledRetirementContributionCreateType), 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 ScheduledRetirementContributionCreateType$ { /** @deprecated use `ScheduledRetirementContributionCreateType$inboundSchema` instead. */ export const inboundSchema = ScheduledRetirementContributionCreateType$inboundSchema; /** @deprecated use `ScheduledRetirementContributionCreateType$outboundSchema` instead. */ export const outboundSchema = ScheduledRetirementContributionCreateType$outboundSchema; } /** @internal */ export const ScheduledRetirementContributionCreate$inboundSchema: z.ZodType< ScheduledRetirementContributionCreate, z.ZodTypeDef, unknown > = z.object({ tax_year: z.number().int().optional(), temporal_tax_year: TemporalTaxYear$inboundSchema.optional(), type: ScheduledRetirementContributionCreateType$inboundSchema, }).transform((v) => { return remap$(v, { "tax_year": "taxYear", "temporal_tax_year": "temporalTaxYear", }); }); /** @internal */ export type ScheduledRetirementContributionCreate$Outbound = { tax_year?: number | undefined; temporal_tax_year?: string | undefined; type: string; }; /** @internal */ export const ScheduledRetirementContributionCreate$outboundSchema: z.ZodType< ScheduledRetirementContributionCreate$Outbound, z.ZodTypeDef, ScheduledRetirementContributionCreate > = z.object({ taxYear: z.number().int().optional(), temporalTaxYear: TemporalTaxYear$outboundSchema.optional(), type: ScheduledRetirementContributionCreateType$outboundSchema, }).transform((v) => { return remap$(v, { taxYear: "tax_year", temporalTaxYear: "temporal_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 ScheduledRetirementContributionCreate$ { /** @deprecated use `ScheduledRetirementContributionCreate$inboundSchema` instead. */ export const inboundSchema = ScheduledRetirementContributionCreate$inboundSchema; /** @deprecated use `ScheduledRetirementContributionCreate$outboundSchema` instead. */ export const outboundSchema = ScheduledRetirementContributionCreate$outboundSchema; /** @deprecated use `ScheduledRetirementContributionCreate$Outbound` instead. */ export type Outbound = ScheduledRetirementContributionCreate$Outbound; } export function scheduledRetirementContributionCreateToJSON( scheduledRetirementContributionCreate: ScheduledRetirementContributionCreate, ): string { return JSON.stringify( ScheduledRetirementContributionCreate$outboundSchema.parse( scheduledRetirementContributionCreate, ), ); } export function scheduledRetirementContributionCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ScheduledRetirementContributionCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ScheduledRetirementContributionCreate' from JSON`, ); }