/* * 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"; import { LegalAgreement, LegalAgreement$inboundSchema, LegalAgreement$Outbound, LegalAgreement$outboundSchema, } from "./legalagreement.js"; /** * The enrollment type. */ export enum EnrollmentType { EnrollmentTypeUnspecified = "ENROLLMENT_TYPE_UNSPECIFIED", RegistrationIndividual = "REGISTRATION_INDIVIDUAL", LendingFullyPaidStockLoan = "LENDING_FULLY_PAID_STOCK_LOAN", BeneficiaryDesignation = "BENEFICIARY_DESIGNATION", RegistrationJointWros = "REGISTRATION_JOINT_WROS", RegistrationJointTic = "REGISTRATION_JOINT_TIC", RegistrationJointTbe = "REGISTRATION_JOINT_TBE", RegistrationJointCp = "REGISTRATION_JOINT_CP", RegistrationEstate = "REGISTRATION_ESTATE", RegistrationIraTraditional = "REGISTRATION_IRA_TRADITIONAL", RegistrationIraSep = "REGISTRATION_IRA_SEP", RegistrationIraRoth = "REGISTRATION_IRA_ROTH", RegistrationIraRollover = "REGISTRATION_IRA_ROLLOVER", RegistrationTrust = "REGISTRATION_TRUST", RegistrationCorporation = "REGISTRATION_CORPORATION", RegistrationLlc = "REGISTRATION_LLC", CashFdicCashSweep = "CASH_FDIC_CASH_SWEEP", RetirementBeneficiaryDesignation = "RETIREMENT_BENEFICIARY_DESIGNATION", DividendReinvestmentPlan = "DIVIDEND_REINVESTMENT_PLAN", RegistrationIraBeneficiaryTraditional = "REGISTRATION_IRA_BENEFICIARY_TRADITIONAL", RegistrationIraBeneficiaryRoth = "REGISTRATION_IRA_BENEFICIARY_ROTH", RegistrationIndividualForeign = "REGISTRATION_INDIVIDUAL_FOREIGN", RegistrationCustodial = "REGISTRATION_CUSTODIAL", RegTMargin = "REG_T_MARGIN", VirtualAccountNumber = "VIRTUAL_ACCOUNT_NUMBER", } /** * The enrollment type. */ export type EnrollmentTypeOpen = OpenEnum; /** * Available Enrollment on an Account. */ export type AvailableEnrollment = { /** * A list of legal agreements associated with the enrollment. */ agreements?: Array | undefined; /** * The enrollment type. */ enrollmentType?: EnrollmentTypeOpen | undefined; }; /** @internal */ export const EnrollmentType$inboundSchema: z.ZodType< EnrollmentTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(EnrollmentType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const EnrollmentType$outboundSchema: z.ZodType< EnrollmentTypeOpen, z.ZodTypeDef, EnrollmentTypeOpen > = z.union([ z.nativeEnum(EnrollmentType), 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 EnrollmentType$ { /** @deprecated use `EnrollmentType$inboundSchema` instead. */ export const inboundSchema = EnrollmentType$inboundSchema; /** @deprecated use `EnrollmentType$outboundSchema` instead. */ export const outboundSchema = EnrollmentType$outboundSchema; } /** @internal */ export const AvailableEnrollment$inboundSchema: z.ZodType< AvailableEnrollment, z.ZodTypeDef, unknown > = z.object({ agreements: z.array(LegalAgreement$inboundSchema).optional(), enrollment_type: EnrollmentType$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "enrollment_type": "enrollmentType", }); }); /** @internal */ export type AvailableEnrollment$Outbound = { agreements?: Array | undefined; enrollment_type?: string | undefined; }; /** @internal */ export const AvailableEnrollment$outboundSchema: z.ZodType< AvailableEnrollment$Outbound, z.ZodTypeDef, AvailableEnrollment > = z.object({ agreements: z.array(LegalAgreement$outboundSchema).optional(), enrollmentType: EnrollmentType$outboundSchema.optional(), }).transform((v) => { return remap$(v, { enrollmentType: "enrollment_type", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AvailableEnrollment$ { /** @deprecated use `AvailableEnrollment$inboundSchema` instead. */ export const inboundSchema = AvailableEnrollment$inboundSchema; /** @deprecated use `AvailableEnrollment$outboundSchema` instead. */ export const outboundSchema = AvailableEnrollment$outboundSchema; /** @deprecated use `AvailableEnrollment$Outbound` instead. */ export type Outbound = AvailableEnrollment$Outbound; } export function availableEnrollmentToJSON( availableEnrollment: AvailableEnrollment, ): string { return JSON.stringify( AvailableEnrollment$outboundSchema.parse(availableEnrollment), ); } export function availableEnrollmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AvailableEnrollment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AvailableEnrollment' from JSON`, ); }