/* * 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"; /** * Tax Authority for Enrollment */ export enum TaxAuthority { TaxAuthorityUnspecified = "TAX_AUTHORITY_UNSPECIFIED", Al = "AL", Ak = "AK", Az = "AZ", Ar = "AR", Ca = "CA", Co = "CO", Ct = "CT", De = "DE", Fl = "FL", Ga = "GA", Hi = "HI", Id = "ID", Il = "IL", In = "IN", Ia = "IA", Ks = "KS", Ky = "KY", La = "LA", Me = "ME", Md = "MD", Ma = "MA", Mi = "MI", Mn = "MN", Ms = "MS", Mo = "MO", Mt = "MT", Ne = "NE", Nv = "NV", Nh = "NH", Nj = "NJ", Nm = "NM", Ny = "NY", Nc = "NC", Nd = "ND", Oh = "OH", Ok = "OK", Or = "OR", Pa = "PA", Ri = "RI", Sc = "SC", Sd = "SD", Tn = "TN", Tx = "TX", Ut = "UT", Vt = "VT", Va = "VA", Wa = "WA", Wv = "WV", Wi = "WI", Wy = "WY", Irs = "IRS", } /** * Tax Authority for Enrollment */ export type TaxAuthorityOpen = OpenEnum; /** * A designation used by the custodian to determine how much federal income tax should be withheld from the proceeds of a sale */ export enum WithholdingType { WithholdingTypeUnspecified = "WITHHOLDING_TYPE_UNSPECIFIED", Backup = "BACKUP", BackupProceeds = "BACKUP_PROCEEDS", BackupDividendsAndInterest = "BACKUP_DIVIDENDS_AND_INTEREST", Ira = "IRA", } /** * A designation used by the custodian to determine how much federal income tax should be withheld from the proceeds of a sale */ export type WithholdingTypeOpen = OpenEnum; /** * Enrollment metadata for TAX_WITHHOLDING operating purpose */ export type TaxWithholdingMetadataCreate = { /** * Tax Authority for Enrollment */ taxAuthority: TaxAuthorityOpen; /** * A designation used by the custodian to determine how much federal income tax should be withheld from the proceeds of a sale */ withholdingType: WithholdingTypeOpen; }; /** @internal */ export const TaxAuthority$inboundSchema: z.ZodType< TaxAuthorityOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TaxAuthority), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TaxAuthority$outboundSchema: z.ZodType< TaxAuthorityOpen, z.ZodTypeDef, TaxAuthorityOpen > = z.union([ z.nativeEnum(TaxAuthority), 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 TaxAuthority$ { /** @deprecated use `TaxAuthority$inboundSchema` instead. */ export const inboundSchema = TaxAuthority$inboundSchema; /** @deprecated use `TaxAuthority$outboundSchema` instead. */ export const outboundSchema = TaxAuthority$outboundSchema; } /** @internal */ export const WithholdingType$inboundSchema: z.ZodType< WithholdingTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(WithholdingType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const WithholdingType$outboundSchema: z.ZodType< WithholdingTypeOpen, z.ZodTypeDef, WithholdingTypeOpen > = z.union([ z.nativeEnum(WithholdingType), 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 WithholdingType$ { /** @deprecated use `WithholdingType$inboundSchema` instead. */ export const inboundSchema = WithholdingType$inboundSchema; /** @deprecated use `WithholdingType$outboundSchema` instead. */ export const outboundSchema = WithholdingType$outboundSchema; } /** @internal */ export const TaxWithholdingMetadataCreate$inboundSchema: z.ZodType< TaxWithholdingMetadataCreate, z.ZodTypeDef, unknown > = z.object({ tax_authority: TaxAuthority$inboundSchema, withholding_type: WithholdingType$inboundSchema, }).transform((v) => { return remap$(v, { "tax_authority": "taxAuthority", "withholding_type": "withholdingType", }); }); /** @internal */ export type TaxWithholdingMetadataCreate$Outbound = { tax_authority: string; withholding_type: string; }; /** @internal */ export const TaxWithholdingMetadataCreate$outboundSchema: z.ZodType< TaxWithholdingMetadataCreate$Outbound, z.ZodTypeDef, TaxWithholdingMetadataCreate > = z.object({ taxAuthority: TaxAuthority$outboundSchema, withholdingType: WithholdingType$outboundSchema, }).transform((v) => { return remap$(v, { taxAuthority: "tax_authority", withholdingType: "withholding_type", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace TaxWithholdingMetadataCreate$ { /** @deprecated use `TaxWithholdingMetadataCreate$inboundSchema` instead. */ export const inboundSchema = TaxWithholdingMetadataCreate$inboundSchema; /** @deprecated use `TaxWithholdingMetadataCreate$outboundSchema` instead. */ export const outboundSchema = TaxWithholdingMetadataCreate$outboundSchema; /** @deprecated use `TaxWithholdingMetadataCreate$Outbound` instead. */ export type Outbound = TaxWithholdingMetadataCreate$Outbound; } export function taxWithholdingMetadataCreateToJSON( taxWithholdingMetadataCreate: TaxWithholdingMetadataCreate, ): string { return JSON.stringify( TaxWithholdingMetadataCreate$outboundSchema.parse( taxWithholdingMetadataCreate, ), ); } export function taxWithholdingMetadataCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TaxWithholdingMetadataCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TaxWithholdingMetadataCreate' from JSON`, ); }