/* * 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"; /** * The max retirement contribution that can be made for the tax year, inclusive of catch-up contributions. Value is dependent on the account's registration type and account holder's age */ export type ContributionLimit = { /** * 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; }; /** * Summed contribution amounts throughout the year */ export type RegularAmount = { /** * 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 remaining regular contribution amount allowed for the tax year. Calculated as the difference between the contribution limit for the account and its regular contribution total to date. This will return zero if the account has no contribution limit. */ export type RemainingContributionAllowed = { /** * 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; }; /** * Rollover contribution amount */ export type RolloverAmount = { /** * 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; }; /** * Regular and rollover contribution amounts for one tax year */ export type ContributionSummary = { /** * The max retirement contribution that can be made for the tax year, inclusive of catch-up contributions. Value is dependent on the account's registration type and account holder's age */ contributionLimit?: ContributionLimit | null | undefined; /** * The resource name of the contribution summary */ name?: string | undefined; /** * Summed contribution amounts throughout the year */ regularAmount?: RegularAmount | null | undefined; /** * The remaining regular contribution amount allowed for the tax year. Calculated as the difference between the contribution limit for the account and its regular contribution total to date. This will return zero if the account has no contribution limit. */ remainingContributionAllowed?: | RemainingContributionAllowed | null | undefined; /** * Rollover contribution amount */ rolloverAmount?: RolloverAmount | null | undefined; /** * Tax year these contribution amounts are for */ taxYear?: number | undefined; }; /** @internal */ export const ContributionLimit$inboundSchema: z.ZodType< ContributionLimit, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type ContributionLimit$Outbound = { value?: string | undefined; }; /** @internal */ export const ContributionLimit$outboundSchema: z.ZodType< ContributionLimit$Outbound, z.ZodTypeDef, ContributionLimit > = 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 ContributionLimit$ { /** @deprecated use `ContributionLimit$inboundSchema` instead. */ export const inboundSchema = ContributionLimit$inboundSchema; /** @deprecated use `ContributionLimit$outboundSchema` instead. */ export const outboundSchema = ContributionLimit$outboundSchema; /** @deprecated use `ContributionLimit$Outbound` instead. */ export type Outbound = ContributionLimit$Outbound; } export function contributionLimitToJSON( contributionLimit: ContributionLimit, ): string { return JSON.stringify( ContributionLimit$outboundSchema.parse(contributionLimit), ); } export function contributionLimitFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContributionLimit$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContributionLimit' from JSON`, ); } /** @internal */ export const RegularAmount$inboundSchema: z.ZodType< RegularAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type RegularAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const RegularAmount$outboundSchema: z.ZodType< RegularAmount$Outbound, z.ZodTypeDef, RegularAmount > = 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 RegularAmount$ { /** @deprecated use `RegularAmount$inboundSchema` instead. */ export const inboundSchema = RegularAmount$inboundSchema; /** @deprecated use `RegularAmount$outboundSchema` instead. */ export const outboundSchema = RegularAmount$outboundSchema; /** @deprecated use `RegularAmount$Outbound` instead. */ export type Outbound = RegularAmount$Outbound; } export function regularAmountToJSON(regularAmount: RegularAmount): string { return JSON.stringify(RegularAmount$outboundSchema.parse(regularAmount)); } export function regularAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RegularAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RegularAmount' from JSON`, ); } /** @internal */ export const RemainingContributionAllowed$inboundSchema: z.ZodType< RemainingContributionAllowed, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type RemainingContributionAllowed$Outbound = { value?: string | undefined; }; /** @internal */ export const RemainingContributionAllowed$outboundSchema: z.ZodType< RemainingContributionAllowed$Outbound, z.ZodTypeDef, RemainingContributionAllowed > = 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 RemainingContributionAllowed$ { /** @deprecated use `RemainingContributionAllowed$inboundSchema` instead. */ export const inboundSchema = RemainingContributionAllowed$inboundSchema; /** @deprecated use `RemainingContributionAllowed$outboundSchema` instead. */ export const outboundSchema = RemainingContributionAllowed$outboundSchema; /** @deprecated use `RemainingContributionAllowed$Outbound` instead. */ export type Outbound = RemainingContributionAllowed$Outbound; } export function remainingContributionAllowedToJSON( remainingContributionAllowed: RemainingContributionAllowed, ): string { return JSON.stringify( RemainingContributionAllowed$outboundSchema.parse( remainingContributionAllowed, ), ); } export function remainingContributionAllowedFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RemainingContributionAllowed$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RemainingContributionAllowed' from JSON`, ); } /** @internal */ export const RolloverAmount$inboundSchema: z.ZodType< RolloverAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type RolloverAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const RolloverAmount$outboundSchema: z.ZodType< RolloverAmount$Outbound, z.ZodTypeDef, RolloverAmount > = 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 RolloverAmount$ { /** @deprecated use `RolloverAmount$inboundSchema` instead. */ export const inboundSchema = RolloverAmount$inboundSchema; /** @deprecated use `RolloverAmount$outboundSchema` instead. */ export const outboundSchema = RolloverAmount$outboundSchema; /** @deprecated use `RolloverAmount$Outbound` instead. */ export type Outbound = RolloverAmount$Outbound; } export function rolloverAmountToJSON(rolloverAmount: RolloverAmount): string { return JSON.stringify(RolloverAmount$outboundSchema.parse(rolloverAmount)); } export function rolloverAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RolloverAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RolloverAmount' from JSON`, ); } /** @internal */ export const ContributionSummary$inboundSchema: z.ZodType< ContributionSummary, z.ZodTypeDef, unknown > = z.object({ contribution_limit: z.nullable(z.lazy(() => ContributionLimit$inboundSchema)) .optional(), name: z.string().optional(), regular_amount: z.nullable(z.lazy(() => RegularAmount$inboundSchema)) .optional(), remaining_contribution_allowed: z.nullable( z.lazy(() => RemainingContributionAllowed$inboundSchema), ).optional(), rollover_amount: z.nullable(z.lazy(() => RolloverAmount$inboundSchema)) .optional(), tax_year: z.number().int().optional(), }).transform((v) => { return remap$(v, { "contribution_limit": "contributionLimit", "regular_amount": "regularAmount", "remaining_contribution_allowed": "remainingContributionAllowed", "rollover_amount": "rolloverAmount", "tax_year": "taxYear", }); }); /** @internal */ export type ContributionSummary$Outbound = { contribution_limit?: ContributionLimit$Outbound | null | undefined; name?: string | undefined; regular_amount?: RegularAmount$Outbound | null | undefined; remaining_contribution_allowed?: | RemainingContributionAllowed$Outbound | null | undefined; rollover_amount?: RolloverAmount$Outbound | null | undefined; tax_year?: number | undefined; }; /** @internal */ export const ContributionSummary$outboundSchema: z.ZodType< ContributionSummary$Outbound, z.ZodTypeDef, ContributionSummary > = z.object({ contributionLimit: z.nullable(z.lazy(() => ContributionLimit$outboundSchema)) .optional(), name: z.string().optional(), regularAmount: z.nullable(z.lazy(() => RegularAmount$outboundSchema)) .optional(), remainingContributionAllowed: z.nullable( z.lazy(() => RemainingContributionAllowed$outboundSchema), ).optional(), rolloverAmount: z.nullable(z.lazy(() => RolloverAmount$outboundSchema)) .optional(), taxYear: z.number().int().optional(), }).transform((v) => { return remap$(v, { contributionLimit: "contribution_limit", regularAmount: "regular_amount", remainingContributionAllowed: "remaining_contribution_allowed", rolloverAmount: "rollover_amount", 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 ContributionSummary$ { /** @deprecated use `ContributionSummary$inboundSchema` instead. */ export const inboundSchema = ContributionSummary$inboundSchema; /** @deprecated use `ContributionSummary$outboundSchema` instead. */ export const outboundSchema = ContributionSummary$outboundSchema; /** @deprecated use `ContributionSummary$Outbound` instead. */ export type Outbound = ContributionSummary$Outbound; } export function contributionSummaryToJSON( contributionSummary: ContributionSummary, ): string { return JSON.stringify( ContributionSummary$outboundSchema.parse(contributionSummary), ); } export function contributionSummaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ContributionSummary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContributionSummary' from JSON`, ); }