/* * 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 { ContributionConstraintsContributionTypeInfo, ContributionConstraintsContributionTypeInfo$inboundSchema, ContributionConstraintsContributionTypeInfo$Outbound, ContributionConstraintsContributionTypeInfo$outboundSchema, } from "./contributionconstraintscontributiontypeinfo.js"; /** * Retirement contribution constraints when depositing money into an Apex account */ export type ContributionConstraints = { /** * Deprecated: please refer to the `valid_types.previous_year_deadline` field instead This value is determined based on the current date relative to the tax deadline. It will be inaccurate in cases where the previous year contribution deadline is not the tax deadline (e.g. `RECHARACTERIZATION`). * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ onlyAllowCurrentYear?: boolean | undefined; /** * Valid contribution types */ validTypes?: Array | undefined; }; /** @internal */ export const ContributionConstraints$inboundSchema: z.ZodType< ContributionConstraints, z.ZodTypeDef, unknown > = z.object({ only_allow_current_year: z.boolean().optional(), valid_types: z.array( ContributionConstraintsContributionTypeInfo$inboundSchema, ).optional(), }).transform((v) => { return remap$(v, { "only_allow_current_year": "onlyAllowCurrentYear", "valid_types": "validTypes", }); }); /** @internal */ export type ContributionConstraints$Outbound = { only_allow_current_year?: boolean | undefined; valid_types?: | Array | undefined; }; /** @internal */ export const ContributionConstraints$outboundSchema: z.ZodType< ContributionConstraints$Outbound, z.ZodTypeDef, ContributionConstraints > = z.object({ onlyAllowCurrentYear: z.boolean().optional(), validTypes: z.array( ContributionConstraintsContributionTypeInfo$outboundSchema, ).optional(), }).transform((v) => { return remap$(v, { onlyAllowCurrentYear: "only_allow_current_year", validTypes: "valid_types", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ContributionConstraints$ { /** @deprecated use `ContributionConstraints$inboundSchema` instead. */ export const inboundSchema = ContributionConstraints$inboundSchema; /** @deprecated use `ContributionConstraints$outboundSchema` instead. */ export const outboundSchema = ContributionConstraints$outboundSchema; /** @deprecated use `ContributionConstraints$Outbound` instead. */ export type Outbound = ContributionConstraints$Outbound; } export function contributionConstraintsToJSON( contributionConstraints: ContributionConstraints, ): string { return JSON.stringify( ContributionConstraints$outboundSchema.parse(contributionConstraints), ); } export function contributionConstraintsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContributionConstraints$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContributionConstraints' from JSON`, ); }