/* * 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 { Agreement, Agreement$inboundSchema, Agreement$Outbound, Agreement$outboundSchema, } from "./agreement.js"; import { Enrollment, Enrollment$inboundSchema, Enrollment$Outbound, Enrollment$outboundSchema, } from "./enrollment.js"; import { Identifier, Identifier$inboundSchema, Identifier$Outbound, Identifier$outboundSchema, } from "./identifier.js"; import { InterestedParty, InterestedParty$inboundSchema, InterestedParty$Outbound, InterestedParty$outboundSchema, } from "./interestedparty.js"; import { Party, Party$inboundSchema, Party$Outbound, Party$outboundSchema, } from "./party.js"; import { TrustedContact, TrustedContact$inboundSchema, TrustedContact$Outbound, TrustedContact$outboundSchema, } from "./trustedcontact.js"; /** * The FINRA CAT classification for the Account Holder; Is set automatically based on attributes of the owners and account type */ export enum AccountCatAccountHolderType { CatAccountHolderTypeUnspecified = "CAT_ACCOUNT_HOLDER_TYPE_UNSPECIFIED", AInstitutionalCustomer = "A_INSTITUTIONAL_CUSTOMER", EEmployeeAccount = "E_EMPLOYEE_ACCOUNT", FForeign = "F_FOREIGN", IIndividual = "I_INDIVIDUAL", OMarketMaking = "O_MARKET_MAKING", VAgencyAveragePriceAccount = "V_AGENCY_AVERAGE_PRICE_ACCOUNT", POtherProprietary = "P_OTHER_PROPRIETARY", XErrorAccount = "X_ERROR_ACCOUNT", } /** * The FINRA CAT classification for the Account Holder; Is set automatically based on attributes of the owners and account type */ export type AccountCatAccountHolderTypeOpen = OpenEnum< typeof AccountCatAccountHolderType >; /** * The CAT reporter information for the account */ export type CatReporterInformation = { /** * The prior CAT reporter's 7 digit CRD number; Must be provided with an `ORIGINATING_FDID` */ originatingCatReporterCrd?: string | undefined; /** * The previous FDID associated with the account; Must be unique and provided with an `ORIGINATING_CAT_REPORTER_CRD` */ originatingFdid?: string | undefined; }; /** * Indicates the CFTC (Commodity Futures Trading Commission) owner type of the account. This enum only applies to accounts regulated by the CFTC */ export enum CftcOwnerType { CftcOwnerTypeUnspecified = "CFTC_OWNER_TYPE_UNSPECIFIED", Customer = "CUSTOMER", Proprietary = "PROPRIETARY", } /** * Indicates the CFTC (Commodity Futures Trading Commission) owner type of the account. This enum only applies to accounts regulated by the CFTC */ export type CftcOwnerTypeOpen = OpenEnum; /** * Indicates if the account is `DOMESTIC` or `FOREIGN` */ export enum Domicile { DomicileUnspecified = "DOMICILE_UNSPECIFIED", Domestic = "DOMESTIC", Foreign = "FOREIGN", } /** * Indicates if the account is `DOMESTIC` or `FOREIGN` */ export type DomicileOpen = OpenEnum; /** * The FINRA COA code associated with the account */ export enum FinraCoaCode { FinraCoaCodeUnspecified = "FINRA_COA_CODE_UNSPECIFIED", Cat01CustomerDvpRvp = "CAT_01_CUSTOMER_DVP_RVP", Cat02CustomerManagedAccounts = "CAT_02_CUSTOMER_MANAGED_ACCOUNTS", Cat03CustomerIraAccounts = "CAT_03_CUSTOMER_IRA_ACCOUNTS", Cat04CustomerEmployee = "CAT_04_CUSTOMER_EMPLOYEE", Cat05CustomerPrimeBroker = "CAT_05_CUSTOMER_PRIME_BROKER", Cat06CustomerAffiliateNonBd = "CAT_06_CUSTOMER_AFFILIATE_NON_BD", Cat07CustomerOmnibus = "CAT_07_CUSTOMER_OMNIBUS", Cat08Customer = "CAT_08_CUSTOMER", Cat09NonCustomerOfficerDirector = "CAT_09_NON_CUSTOMER_OFFICER_DIRECTOR", Cat10NonCustomerOfficerDirectorOrFamilyMembers = "CAT_10_NON_CUSTOMER_OFFICER_DIRECTOR_OR_FAMILY_MEMBERS", Cat11NonCustomerAffiliateBd = "CAT_11_NON_CUSTOMER_AFFILIATE_BD", Cat12NonCustomerOmnibus = "CAT_12_NON_CUSTOMER_OMNIBUS", Cat13NonCustomer = "CAT_13_NON_CUSTOMER", Cat14Paib = "CAT_14_PAIB", Cat15FirmInventory = "CAT_15_FIRM_INVENTORY", Cat16CnsFails = "CAT_16_CNS_FAILS", Cat17OtherClearingCorpFails = "CAT_17_OTHER_CLEARING_CORP_FAILS", Cat18ExecutingPrimeBroker = "CAT_18_EXECUTING_PRIME_BROKER", Cat19BrokerFailsToReceive = "CAT_19_BROKER_FAILS_TO_RECEIVE", Cat20BrokerFailsToDeliver = "CAT_20_BROKER_FAILS_TO_DELIVER", Cat21BrokerFails = "CAT_21_BROKER_FAILS", Cat22FailToDeliverGreaterThan30Days = "CAT_22_FAIL_TO_DELIVER_GREATER_THAN_30_DAYS", Cat23SecuritiesBorrowed = "CAT_23_SECURITIES_BORROWED", Cat24SecuritiesBorrowedNonCash = "CAT_24_SECURITIES_BORROWED_NON_CASH", Cat25SecuritiesBorrowedConduit = "CAT_25_SECURITIES_BORROWED_CONDUIT", Cat26SecuritiesLoaned = "CAT_26_SECURITIES_LOANED", Cat27SecuritiesLoanedNonCash = "CAT_27_SECURITIES_LOANED_NON_CASH", Cat28SecuritiesLoanedConduit = "CAT_28_SECURITIES_LOANED_CONDUIT", Cat29SecuritiesLoanedCns = "CAT_29_SECURITIES_LOANED_CNS", Cat30ReverseRepo = "CAT_30_REVERSE_REPO", Cat31ReverseRepoTriParty = "CAT_31_REVERSE_REPO_TRI_PARTY", Cat32Repo = "CAT_32_REPO", Cat33RepoHoldInCustody = "CAT_33_REPO_HOLD_IN_CUSTODY", Cat34RepoTriParty = "CAT_34_REPO_TRI_PARTY", Cat35BankLoanFirm = "CAT_35_BANK_LOAN_FIRM", Cat36BankLoanCustomer = "CAT_36_BANK_LOAN_CUSTOMER", Cat37BankLoanNonCustomer = "CAT_37_BANK_LOAN_NON_CUSTOMER", Cat38BankLoanPaib = "CAT_38_BANK_LOAN_PAIB", Cat39Suspense = "CAT_39_SUSPENSE", Cat40Reorganizations = "CAT_40_REORGANIZATIONS", Cat41StockDividends = "CAT_41_STOCK_DIVIDENDS", Cat42AbandonedProperty = "CAT_42_ABANDONED_PROPERTY", Cat43PhysicalBox = "CAT_43_PHYSICAL_BOX", Cat44LegalBox = "CAT_44_LEGAL_BOX", Cat45Safekeeping = "CAT_45_SAFEKEEPING", Cat4615C33Deposit = "CAT_46_15C3_3_DEPOSIT", Cat47DomesticDepositoryControl = "CAT_47_DOMESTIC_DEPOSITORY_CONTROL", Cat48ForeignDepositoryControl = "CAT_48_FOREIGN_DEPOSITORY_CONTROL", Cat49DomesticDepositoryNonControl = "CAT_49_DOMESTIC_DEPOSITORY_NON_CONTROL", Cat50ForeignDepositoryNonControl = "CAT_50_FOREIGN_DEPOSITORY_NON_CONTROL", Cat51TransferControl = "CAT_51_TRANSFER_CONTROL", Cat52TransferNonControl = "CAT_52_TRANSFER_NON_CONTROL", Cat53TransferLegal = "CAT_53_TRANSFER_LEGAL", Cat54InTransitControl = "CAT_54_IN_TRANSIT_CONTROL", Cat55InTransitNonControl = "CAT_55_IN_TRANSIT_NON_CONTROL", Cat56ClearingDomestic = "CAT_56_CLEARING_DOMESTIC", Cat57ClearingForeign = "CAT_57_CLEARING_FOREIGN", Cat58TestAccount = "CAT_58_TEST_ACCOUNT", Cat59OutOfBalance = "CAT_59_OUT_OF_BALANCE", Cat60Conversion = "CAT_60_CONVERSION", Cat61DepositsOccMargin = "CAT_61_DEPOSITS_OCC_MARGIN", Cat62DepositsOther = "CAT_62_DEPOSITS_OTHER", Cat63Other = "CAT_63_OTHER", } /** * The FINRA COA code associated with the account */ export type FinraCoaCodeOpen = OpenEnum; /** * Describes if the account is cash-only or has access to a form of margin */ export enum FundingType { FundingTypeUnspecified = "FUNDING_TYPE_UNSPECIFIED", Cash = "CASH", MarginLimitedPurpose = "MARGIN_LIMITED_PURPOSE", MarginRegT = "MARGIN_REG_T", MarginPortfolio = "MARGIN_PORTFOLIO", } /** * Describes if the account is cash-only or has access to a form of margin */ export type FundingTypeOpen = OpenEnum; /** * The financial goal or purpose that an investor has in mind when making investment decisions; firms often ask investors to specify their investment objectives when opening an account, in order to provide appropriate investment recommendations and manage risk appropriately */ export enum AccountInvestmentObjective { InvestmentObjectiveUnspecified = "INVESTMENT_OBJECTIVE_UNSPECIFIED", Balanced = "BALANCED", CapitalAppreciation = "CAPITAL_APPRECIATION", CapitalPreservation = "CAPITAL_PRESERVATION", Growth = "GROWTH", GrowthAndIncome = "GROWTH_AND_INCOME", GrowthIncome = "GROWTH_INCOME", Income = "INCOME", LongTermGrowthWithGreaterRisk = "LONG_TERM_GROWTH_WITH_GREATER_RISK", LongTermGrowthWithSafety = "LONG_TERM_GROWTH_WITH_SAFETY", MaximumGrowth = "MAXIMUM_GROWTH", ShortTermGrowthWithRisk = "SHORT_TERM_GROWTH_WITH_RISK", Speculation = "SPECULATION", Other = "OTHER", } /** * The financial goal or purpose that an investor has in mind when making investment decisions; firms often ask investors to specify their investment objectives when opening an account, in order to provide appropriate investment recommendations and manage risk appropriately */ export type AccountInvestmentObjectiveOpen = OpenEnum< typeof AccountInvestmentObjective >; /** * An investor’s short-term cash requirements or the need to access funds quickly; it is important to consider an investor’s liquidity needs to ensure that they have sufficient cash or easily liquidated assets available to meet their financial obligations - this may include holding cash or cash equivalents */ export enum AccountLiquidityNeeds { LiquidityNeedsUnspecified = "LIQUIDITY_NEEDS_UNSPECIFIED", VeryImportant = "VERY_IMPORTANT", SomewhatImportant = "SOMEWHAT_IMPORTANT", NotImportant = "NOT_IMPORTANT", } /** * An investor’s short-term cash requirements or the need to access funds quickly; it is important to consider an investor’s liquidity needs to ensure that they have sufficient cash or easily liquidated assets available to meet their financial obligations - this may include holding cash or cash equivalents */ export type AccountLiquidityNeedsOpen = OpenEnum; /** * An investor’s willingness and ability to tolerate risk when making investment decisions; reflects the investor’s comfort level with the potential ups and downs of the market and their ability to withstand potential losses */ export enum AccountRiskTolerance { RiskToleranceUnspecified = "RISK_TOLERANCE_UNSPECIFIED", Low = "LOW", Medium = "MEDIUM", High = "HIGH", } /** * An investor’s willingness and ability to tolerate risk when making investment decisions; reflects the investor’s comfort level with the potential ups and downs of the market and their ability to withstand potential losses */ export type AccountRiskToleranceOpen = OpenEnum; /** * TThe length of time an investor expects to hold an investment before selling it; this can affect the appropriate asset allocation and risk level for the portfolio */ export enum AccountTimeHorizon { TimeHorizonUnspecified = "TIME_HORIZON_UNSPECIFIED", Short = "SHORT", Average = "AVERAGE", Long = "LONG", } /** * TThe length of time an investor expects to hold an investment before selling it; this can affect the appropriate asset allocation and risk level for the portfolio */ export type AccountTimeHorizonOpen = OpenEnum; /** * Account goals. */ export type AccountGoals = { /** * The financial goal or purpose that an investor has in mind when making investment decisions; firms often ask investors to specify their investment objectives when opening an account, in order to provide appropriate investment recommendations and manage risk appropriately */ investmentObjective?: AccountInvestmentObjectiveOpen | undefined; /** * An investor’s short-term cash requirements or the need to access funds quickly; it is important to consider an investor’s liquidity needs to ensure that they have sufficient cash or easily liquidated assets available to meet their financial obligations - this may include holding cash or cash equivalents */ liquidityNeeds?: AccountLiquidityNeedsOpen | undefined; /** * An investor’s willingness and ability to tolerate risk when making investment decisions; reflects the investor’s comfort level with the potential ups and downs of the market and their ability to withstand potential losses */ riskTolerance?: AccountRiskToleranceOpen | undefined; /** * TThe length of time an investor expects to hold an investment before selling it; this can affect the appropriate asset allocation and risk level for the portfolio */ timeHorizon?: AccountTimeHorizonOpen | undefined; }; /** * Annual income range; the low number is exclusive, the high number is inclusive */ export enum AccountAnnualIncomeRangeUsd { UsdRangeUnspecified = "USD_RANGE_UNSPECIFIED", Under25K = "UNDER_25K", From25KTo50K = "FROM_25K_TO_50K", From50KTo100K = "FROM_50K_TO_100K", From100KTo200K = "FROM_100K_TO_200K", From200KTo300K = "FROM_200K_TO_300K", From300KTo500K = "FROM_300K_TO_500K", From500KTo1M = "FROM_500K_TO_1M", From1MTo5M = "FROM_1M_TO_5M", Over5M = "OVER_5M", } /** * Annual income range; the low number is exclusive, the high number is inclusive */ export type AccountAnnualIncomeRangeUsdOpen = OpenEnum< typeof AccountAnnualIncomeRangeUsd >; /** * Investment experience. */ export enum AccountInvestmentExperience { InvestmentExperienceUnspecified = "INVESTMENT_EXPERIENCE_UNSPECIFIED", None = "NONE", Limited = "LIMITED", Good = "GOOD", Extensive = "EXTENSIVE", } /** * Investment experience. */ export type AccountInvestmentExperienceOpen = OpenEnum< typeof AccountInvestmentExperience >; /** * Liquid net worth range; the low number is exclusive, the high number is inclusive */ export enum AccountLiquidNetWorthRangeUsd { UsdRangeUnspecified = "USD_RANGE_UNSPECIFIED", Under25K = "UNDER_25K", From25KTo50K = "FROM_25K_TO_50K", From50KTo100K = "FROM_50K_TO_100K", From100KTo200K = "FROM_100K_TO_200K", From200KTo300K = "FROM_200K_TO_300K", From300KTo500K = "FROM_300K_TO_500K", From500KTo1M = "FROM_500K_TO_1M", From1MTo5M = "FROM_1M_TO_5M", Over5M = "OVER_5M", } /** * Liquid net worth range; the low number is exclusive, the high number is inclusive */ export type AccountLiquidNetWorthRangeUsdOpen = OpenEnum< typeof AccountLiquidNetWorthRangeUsd >; /** * Total net worth range; the low number is exclusive, the high number is inclusive */ export enum AccountTotalNetWorthRangeUsd { UsdRangeUnspecified = "USD_RANGE_UNSPECIFIED", Under25K = "UNDER_25K", From25KTo50K = "FROM_25K_TO_50K", From50KTo100K = "FROM_50K_TO_100K", From100KTo200K = "FROM_100K_TO_200K", From200KTo300K = "FROM_200K_TO_300K", From300KTo500K = "FROM_300K_TO_500K", From500KTo1M = "FROM_500K_TO_1M", From1MTo5M = "FROM_1M_TO_5M", Over5M = "OVER_5M", } /** * Total net worth range; the low number is exclusive, the high number is inclusive */ export type AccountTotalNetWorthRangeUsdOpen = OpenEnum< typeof AccountTotalNetWorthRangeUsd >; /** * Customer profile. */ export type CustomerProfile = { /** * Annual income range; the low number is exclusive, the high number is inclusive */ annualIncomeRangeUsd?: AccountAnnualIncomeRangeUsdOpen | undefined; /** * Federal tax bracket percent. */ federalTaxBracket?: number | undefined; /** * Investment experience. */ investmentExperience?: AccountInvestmentExperienceOpen | undefined; /** * Liquid net worth range; the low number is exclusive, the high number is inclusive */ liquidNetWorthRangeUsd?: AccountLiquidNetWorthRangeUsdOpen | undefined; /** * Total net worth range; the low number is exclusive, the high number is inclusive */ totalNetWorthRangeUsd?: AccountTotalNetWorthRangeUsdOpen | undefined; }; /** * The account's goals and customer's financial profile; Used to assess customer fitness and is required by FINRA */ export type InvestmentProfile = { /** * Account goals. */ accountGoals?: AccountGoals | null | undefined; /** * Customer profile. */ customerProfile?: CustomerProfile | null | undefined; /** * The investment profile ID (generated internally). */ investmentProfileId?: string | undefined; }; /** * A roll-up account classification based on the `registration_type`; Indicates what owns the account and/or if it is a special type (e.g., Joint, Estate, Retirement, etc.); Used primarily for reporting and high-level type identification */ export enum OwnershipType { OwnershipTypeUnspecified = "OWNERSHIP_TYPE_UNSPECIFIED", Individual = "INDIVIDUAL", Joint = "JOINT", Estate = "ESTATE", Retirement = "RETIREMENT", Trust = "TRUST", Entity = "ENTITY", Minor = "MINOR", } /** * A roll-up account classification based on the `registration_type`; Indicates what owns the account and/or if it is a special type (e.g., Joint, Estate, Retirement, etc.); Used primarily for reporting and high-level type identification */ export type OwnershipTypeOpen = OpenEnum; /** * The registration of the account (e.g. Individual, Joint, IRA, etc.) */ export enum RegistrationType { RegistrationTypeUnspecified = "REGISTRATION_TYPE_UNSPECIFIED", IndividualRegistration = "INDIVIDUAL_REGISTRATION", EstateRegistration = "ESTATE_REGISTRATION", TraditionalIraRegistration = "TRADITIONAL_IRA_REGISTRATION", SepIraRegistration = "SEP_IRA_REGISTRATION", RothIraRegistration = "ROTH_IRA_REGISTRATION", RolloverIraRegistration = "ROLLOVER_IRA_REGISTRATION", JointWithRightsOfSurvivorshipRegistration = "JOINT_WITH_RIGHTS_OF_SURVIVORSHIP_REGISTRATION", JointTenantsInCommonRegistration = "JOINT_TENANTS_IN_COMMON_REGISTRATION", JointTenantsByEntiretyRegistration = "JOINT_TENANTS_BY_ENTIRETY_REGISTRATION", JointCommunityPropertyRegistration = "JOINT_COMMUNITY_PROPERTY_REGISTRATION", TrustRegistration = "TRUST_REGISTRATION", CorporationRegistration = "CORPORATION_REGISTRATION", LlcRegistration = "LLC_REGISTRATION", OperatingRegistration = "OPERATING_REGISTRATION", IraBeneficiaryTraditionalRegistration = "IRA_BENEFICIARY_TRADITIONAL_REGISTRATION", IraBeneficiaryRothRegistration = "IRA_BENEFICIARY_ROTH_REGISTRATION", ForeignIndividualRegistration = "FOREIGN_INDIVIDUAL_REGISTRATION", CustodialRegistration = "CUSTODIAL_REGISTRATION", } /** * The registration of the account (e.g. Individual, Joint, IRA, etc.) */ export type RegistrationTypeOpen = OpenEnum; /** * The Reserve Class associated with the account */ export enum ReserveClass { ReserveClassUnspecified = "RESERVE_CLASS_UNSPECIFIED", Customer = "CUSTOMER", Pab = "PAB", Firm = "FIRM", Street = "STREET", GL = "G_L", FuturesCustomer = "FUTURES_CUSTOMER", } /** * The Reserve Class associated with the account */ export type ReserveClassOpen = OpenEnum; /** * Indicates if the account is `OPEN`, `PENDING`, or `CLOSED` */ export enum AccountState { StateUnspecified = "STATE_UNSPECIFIED", Pending = "PENDING", Open = "OPEN", Closed = "CLOSED", } /** * Indicates if the account is `OPEN`, `PENDING`, or `CLOSED` */ export type AccountStateOpen = OpenEnum; /** * A method of determining the cost basis of an asset that has been sold or disposed of, by identifying which specific lot of the asset was sold and using the cost of that lot to calculate the cost basis; this method is commonly used for tax purposes to determine the amount of reportable capital gains or losses By default, this is set to `COST_BASIS_LOT_DISPOSAL_MIN_TAX_TERM` */ export enum AccountCostBasisLotDisposalMethod { CostBasisLotDisposalMethodUnspecified = "COST_BASIS_LOT_DISPOSAL_METHOD_UNSPECIFIED", CostBasisLotDisposalFifo = "COST_BASIS_LOT_DISPOSAL_FIFO", CostBasisLotDisposalLifo = "COST_BASIS_LOT_DISPOSAL_LIFO", CostBasisLotDisposalHighCost = "COST_BASIS_LOT_DISPOSAL_HIGH_COST", CostBasisLotDisposalHighCostLongTerm = "COST_BASIS_LOT_DISPOSAL_HIGH_COST_LONG_TERM", CostBasisLotDisposalHighCostShortTerm = "COST_BASIS_LOT_DISPOSAL_HIGH_COST_SHORT_TERM", CostBasisLotDisposalLowCost = "COST_BASIS_LOT_DISPOSAL_LOW_COST", CostBasisLotDisposalLowCostLongTerm = "COST_BASIS_LOT_DISPOSAL_LOW_COST_LONG_TERM", CostBasisLotDisposalLowCostShortTerm = "COST_BASIS_LOT_DISPOSAL_LOW_COST_SHORT_TERM", CostBasisLotDisposalMinTaxTerm = "COST_BASIS_LOT_DISPOSAL_MIN_TAX_TERM", } /** * A method of determining the cost basis of an asset that has been sold or disposed of, by identifying which specific lot of the asset was sold and using the cost of that lot to calculate the cost basis; this method is commonly used for tax purposes to determine the amount of reportable capital gains or losses By default, this is set to `COST_BASIS_LOT_DISPOSAL_MIN_TAX_TERM` */ export type AccountCostBasisLotDisposalMethodOpen = OpenEnum< typeof AccountCostBasisLotDisposalMethod >; /** * Tax-related attributes for the account; A tax profile with taxpayer attributes is located on the `legal_natural_person` or `legal_entity` objects elsewhere on the account record */ export type AccountTaxProfile = { /** * A method of determining the cost basis of an asset that has been sold or disposed of, by identifying which specific lot of the asset was sold and using the cost of that lot to calculate the cost basis; this method is commonly used for tax purposes to determine the amount of reportable capital gains or losses By default, this is set to `COST_BASIS_LOT_DISPOSAL_MIN_TAX_TERM` */ costBasisLotDisposalMethod?: | AccountCostBasisLotDisposalMethodOpen | undefined; /** * Indicates if the account is eligible to mark-to-market their securities and commodities holdings; Named after the related section of the IRS tax code. By default, this is set to `false`. */ section475Election?: boolean | undefined; }; /** * An Account as represented in the account ecosystem. */ export type Account = { /** * Indicates if the issuer of a security held by the account is permitted to communicate directly with the shareholder versus through the brokerage firm; This can include sending proxy statements, annual reports, and other important information directly to the shareholder's address on file with the brokerage firm. By default, this is set to `false`. */ acceptsIssuerDirectCommunication?: boolean | undefined; /** * An Account Group is a way of segmenting accounts within a Correspondent; It is up to the client to define what these groups are and AFS Operations is responsible for configuring them; If the client requests additional groups/codes, they can be added; Examples of Account Groups could hypothetically include HNW (High Net Worth), GOLD (Gold Status Customer), and NWC (Northwest Branch Customer) */ accountGroupId?: string | undefined; /** * A globally unique identifier referencing a single account; This is the main identifier for an account used for machine-to-machine interactions */ accountId?: string | undefined; /** * A "unique" identifier referencing this single account This should be the human readable identifier for the account used for display */ accountNumber?: string | undefined; /** * The list of restrictions currently impacting a given account; Restrictions suspend one or more entitlements dependent on their mapping */ activeRestrictions?: Array | undefined; /** * A boolean to indicate if an account is advised. By default, this is set to `false`. */ advised?: boolean | undefined; /** * The collection of legal agreements belonging to a given account */ agreements?: Array | undefined; /** * The FINRA CAT classification for the Account Holder; Is set automatically based on attributes of the owners and account type */ catAccountHolderType?: AccountCatAccountHolderTypeOpen | undefined; /** * The CAT reporter information for the account */ catReporterInformation?: CatReporterInformation | null | undefined; /** * Indicates the CFTC (Commodity Futures Trading Commission) owner type of the account. This enum only applies to accounts regulated by the CFTC */ cftcOwnerType?: CftcOwnerTypeOpen | undefined; /** * An external identifier for the account. This identifier does not have internal uniqueness constraints. */ clientAccountId?: string | undefined; /** * The time the account was closed; If the account is not closed, this is null */ closeTime?: Date | null | undefined; /** * A unique identifier referencing a Correspondent; A Client may have several operating Correspondents within its purview. */ correspondentId?: string | undefined; /** * The time the initial account record was created; May differ from the `open_time` timestamp which depends on when all required data was provided to the system */ createTime?: Date | null | undefined; /** * Indicates if the account is `DOMESTIC` or `FOREIGN` */ domicile?: DomicileOpen | undefined; /** * A list of enrollments (or "features") on an account; May consist of both active an inactive enrollments */ enrollments?: Array | undefined; /** * Apex requires a Firm-Designated ID (FDID) for Consolidated Audit Trail (CAT) reporting and uses it as a unique identifier for each trading account; The identifier cannot be the same as the accountID; Apex automatically assigns this ID. */ fdid?: string | undefined; /** * The FINRA COA code associated with the account */ finraCoaCode?: FinraCoaCodeOpen | undefined; /** * Describes if the account is cash-only or has access to a form of margin */ fundingType?: FundingTypeOpen | undefined; /** * A list of identifiers associated with the account * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ identifiers?: Array | undefined; /** * A list of natural persons indicated to receive selected account documents such as account statements */ interestedParties?: Array | undefined; /** * The account's goals and customer's financial profile; Used to assess customer fitness and is required by FINRA */ investmentProfile?: InvestmentProfile | null | undefined; /** * A boolean to indicate if an account is managed. By default, this is set to `false`. */ managed?: boolean | undefined; /** * An identifier generated for all non-cash accounts; Uses a combination of account type and owner information to tie accounts together in order to perform margin calculations */ marginGroupId?: string | undefined; /** * The name field Format: accounts/{account} */ name?: string | undefined; /** * The time the account was activated; Differs from `create_time` which is when the initial account record was created */ openTime?: Date | null | undefined; /** * The previous account ID associated with the account; Must be unique */ originatingAccountId?: string | undefined; /** * A roll-up account classification based on the `registration_type`; Indicates what owns the account and/or if it is a special type (e.g., Joint, Estate, Retirement, etc.); Used primarily for reporting and high-level type identification */ ownershipType?: OwnershipTypeOpen | undefined; /** * Parties associated with the account (e.g. custodian). */ parties?: Array | undefined; /** * Indicates if the customer is a PDT; This is set if the account executes four or more day trades (buy and sell the same security intraday) within a period of five business days. By default, this is set to `false`. */ patternDayTrader?: boolean | undefined; /** * The primary registered representative for the account */ primaryRegisteredRepId?: string | undefined; /** * The registration of the account (e.g. Individual, Joint, IRA, etc.) */ registrationType?: RegistrationTypeOpen | undefined; /** * The Reserve Class associated with the account */ reserveClass?: ReserveClassOpen | undefined; /** * Indicates if the account is `OPEN`, `PENDING`, or `CLOSED` */ state?: AccountStateOpen | undefined; /** * Tax-related attributes for the account; A tax profile with taxpayer attributes is located on the `legal_natural_person` or `legal_entity` objects elsewhere on the account record */ taxProfile?: AccountTaxProfile | null | undefined; /** * The title of the account. */ title?: string | undefined; /** * A list of persons designated to verify the well being of the account holder. */ trustedContacts?: Array | undefined; /** * A boolean to indicate if an account is a wrap brokerage account. By default, this is set to `false`. */ wrapFeeBilled?: boolean | undefined; }; /** @internal */ export const AccountCatAccountHolderType$inboundSchema: z.ZodType< AccountCatAccountHolderTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccountCatAccountHolderType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccountCatAccountHolderType$outboundSchema: z.ZodType< AccountCatAccountHolderTypeOpen, z.ZodTypeDef, AccountCatAccountHolderTypeOpen > = z.union([ z.nativeEnum(AccountCatAccountHolderType), 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 AccountCatAccountHolderType$ { /** @deprecated use `AccountCatAccountHolderType$inboundSchema` instead. */ export const inboundSchema = AccountCatAccountHolderType$inboundSchema; /** @deprecated use `AccountCatAccountHolderType$outboundSchema` instead. */ export const outboundSchema = AccountCatAccountHolderType$outboundSchema; } /** @internal */ export const CatReporterInformation$inboundSchema: z.ZodType< CatReporterInformation, z.ZodTypeDef, unknown > = z.object({ originating_cat_reporter_crd: z.string().optional(), originating_fdid: z.string().optional(), }).transform((v) => { return remap$(v, { "originating_cat_reporter_crd": "originatingCatReporterCrd", "originating_fdid": "originatingFdid", }); }); /** @internal */ export type CatReporterInformation$Outbound = { originating_cat_reporter_crd?: string | undefined; originating_fdid?: string | undefined; }; /** @internal */ export const CatReporterInformation$outboundSchema: z.ZodType< CatReporterInformation$Outbound, z.ZodTypeDef, CatReporterInformation > = z.object({ originatingCatReporterCrd: z.string().optional(), originatingFdid: z.string().optional(), }).transform((v) => { return remap$(v, { originatingCatReporterCrd: "originating_cat_reporter_crd", originatingFdid: "originating_fdid", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CatReporterInformation$ { /** @deprecated use `CatReporterInformation$inboundSchema` instead. */ export const inboundSchema = CatReporterInformation$inboundSchema; /** @deprecated use `CatReporterInformation$outboundSchema` instead. */ export const outboundSchema = CatReporterInformation$outboundSchema; /** @deprecated use `CatReporterInformation$Outbound` instead. */ export type Outbound = CatReporterInformation$Outbound; } export function catReporterInformationToJSON( catReporterInformation: CatReporterInformation, ): string { return JSON.stringify( CatReporterInformation$outboundSchema.parse(catReporterInformation), ); } export function catReporterInformationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CatReporterInformation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CatReporterInformation' from JSON`, ); } /** @internal */ export const CftcOwnerType$inboundSchema: z.ZodType< CftcOwnerTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(CftcOwnerType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const CftcOwnerType$outboundSchema: z.ZodType< CftcOwnerTypeOpen, z.ZodTypeDef, CftcOwnerTypeOpen > = z.union([ z.nativeEnum(CftcOwnerType), 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 CftcOwnerType$ { /** @deprecated use `CftcOwnerType$inboundSchema` instead. */ export const inboundSchema = CftcOwnerType$inboundSchema; /** @deprecated use `CftcOwnerType$outboundSchema` instead. */ export const outboundSchema = CftcOwnerType$outboundSchema; } /** @internal */ export const Domicile$inboundSchema: z.ZodType< DomicileOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(Domicile), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const Domicile$outboundSchema: z.ZodType< DomicileOpen, z.ZodTypeDef, DomicileOpen > = z.union([ z.nativeEnum(Domicile), 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 Domicile$ { /** @deprecated use `Domicile$inboundSchema` instead. */ export const inboundSchema = Domicile$inboundSchema; /** @deprecated use `Domicile$outboundSchema` instead. */ export const outboundSchema = Domicile$outboundSchema; } /** @internal */ export const FinraCoaCode$inboundSchema: z.ZodType< FinraCoaCodeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(FinraCoaCode), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const FinraCoaCode$outboundSchema: z.ZodType< FinraCoaCodeOpen, z.ZodTypeDef, FinraCoaCodeOpen > = z.union([ z.nativeEnum(FinraCoaCode), 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 FinraCoaCode$ { /** @deprecated use `FinraCoaCode$inboundSchema` instead. */ export const inboundSchema = FinraCoaCode$inboundSchema; /** @deprecated use `FinraCoaCode$outboundSchema` instead. */ export const outboundSchema = FinraCoaCode$outboundSchema; } /** @internal */ export const FundingType$inboundSchema: z.ZodType< FundingTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(FundingType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const FundingType$outboundSchema: z.ZodType< FundingTypeOpen, z.ZodTypeDef, FundingTypeOpen > = z.union([ z.nativeEnum(FundingType), 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 FundingType$ { /** @deprecated use `FundingType$inboundSchema` instead. */ export const inboundSchema = FundingType$inboundSchema; /** @deprecated use `FundingType$outboundSchema` instead. */ export const outboundSchema = FundingType$outboundSchema; } /** @internal */ export const AccountInvestmentObjective$inboundSchema: z.ZodType< AccountInvestmentObjectiveOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccountInvestmentObjective), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccountInvestmentObjective$outboundSchema: z.ZodType< AccountInvestmentObjectiveOpen, z.ZodTypeDef, AccountInvestmentObjectiveOpen > = z.union([ z.nativeEnum(AccountInvestmentObjective), 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 AccountInvestmentObjective$ { /** @deprecated use `AccountInvestmentObjective$inboundSchema` instead. */ export const inboundSchema = AccountInvestmentObjective$inboundSchema; /** @deprecated use `AccountInvestmentObjective$outboundSchema` instead. */ export const outboundSchema = AccountInvestmentObjective$outboundSchema; } /** @internal */ export const AccountLiquidityNeeds$inboundSchema: z.ZodType< AccountLiquidityNeedsOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccountLiquidityNeeds), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccountLiquidityNeeds$outboundSchema: z.ZodType< AccountLiquidityNeedsOpen, z.ZodTypeDef, AccountLiquidityNeedsOpen > = z.union([ z.nativeEnum(AccountLiquidityNeeds), 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 AccountLiquidityNeeds$ { /** @deprecated use `AccountLiquidityNeeds$inboundSchema` instead. */ export const inboundSchema = AccountLiquidityNeeds$inboundSchema; /** @deprecated use `AccountLiquidityNeeds$outboundSchema` instead. */ export const outboundSchema = AccountLiquidityNeeds$outboundSchema; } /** @internal */ export const AccountRiskTolerance$inboundSchema: z.ZodType< AccountRiskToleranceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccountRiskTolerance), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccountRiskTolerance$outboundSchema: z.ZodType< AccountRiskToleranceOpen, z.ZodTypeDef, AccountRiskToleranceOpen > = z.union([ z.nativeEnum(AccountRiskTolerance), 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 AccountRiskTolerance$ { /** @deprecated use `AccountRiskTolerance$inboundSchema` instead. */ export const inboundSchema = AccountRiskTolerance$inboundSchema; /** @deprecated use `AccountRiskTolerance$outboundSchema` instead. */ export const outboundSchema = AccountRiskTolerance$outboundSchema; } /** @internal */ export const AccountTimeHorizon$inboundSchema: z.ZodType< AccountTimeHorizonOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccountTimeHorizon), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccountTimeHorizon$outboundSchema: z.ZodType< AccountTimeHorizonOpen, z.ZodTypeDef, AccountTimeHorizonOpen > = z.union([ z.nativeEnum(AccountTimeHorizon), 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 AccountTimeHorizon$ { /** @deprecated use `AccountTimeHorizon$inboundSchema` instead. */ export const inboundSchema = AccountTimeHorizon$inboundSchema; /** @deprecated use `AccountTimeHorizon$outboundSchema` instead. */ export const outboundSchema = AccountTimeHorizon$outboundSchema; } /** @internal */ export const AccountGoals$inboundSchema: z.ZodType< AccountGoals, z.ZodTypeDef, unknown > = z.object({ investment_objective: AccountInvestmentObjective$inboundSchema.optional(), liquidity_needs: AccountLiquidityNeeds$inboundSchema.optional(), risk_tolerance: AccountRiskTolerance$inboundSchema.optional(), time_horizon: AccountTimeHorizon$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "investment_objective": "investmentObjective", "liquidity_needs": "liquidityNeeds", "risk_tolerance": "riskTolerance", "time_horizon": "timeHorizon", }); }); /** @internal */ export type AccountGoals$Outbound = { investment_objective?: string | undefined; liquidity_needs?: string | undefined; risk_tolerance?: string | undefined; time_horizon?: string | undefined; }; /** @internal */ export const AccountGoals$outboundSchema: z.ZodType< AccountGoals$Outbound, z.ZodTypeDef, AccountGoals > = z.object({ investmentObjective: AccountInvestmentObjective$outboundSchema.optional(), liquidityNeeds: AccountLiquidityNeeds$outboundSchema.optional(), riskTolerance: AccountRiskTolerance$outboundSchema.optional(), timeHorizon: AccountTimeHorizon$outboundSchema.optional(), }).transform((v) => { return remap$(v, { investmentObjective: "investment_objective", liquidityNeeds: "liquidity_needs", riskTolerance: "risk_tolerance", timeHorizon: "time_horizon", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountGoals$ { /** @deprecated use `AccountGoals$inboundSchema` instead. */ export const inboundSchema = AccountGoals$inboundSchema; /** @deprecated use `AccountGoals$outboundSchema` instead. */ export const outboundSchema = AccountGoals$outboundSchema; /** @deprecated use `AccountGoals$Outbound` instead. */ export type Outbound = AccountGoals$Outbound; } export function accountGoalsToJSON(accountGoals: AccountGoals): string { return JSON.stringify(AccountGoals$outboundSchema.parse(accountGoals)); } export function accountGoalsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountGoals$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountGoals' from JSON`, ); } /** @internal */ export const AccountAnnualIncomeRangeUsd$inboundSchema: z.ZodType< AccountAnnualIncomeRangeUsdOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccountAnnualIncomeRangeUsd), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccountAnnualIncomeRangeUsd$outboundSchema: z.ZodType< AccountAnnualIncomeRangeUsdOpen, z.ZodTypeDef, AccountAnnualIncomeRangeUsdOpen > = z.union([ z.nativeEnum(AccountAnnualIncomeRangeUsd), 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 AccountAnnualIncomeRangeUsd$ { /** @deprecated use `AccountAnnualIncomeRangeUsd$inboundSchema` instead. */ export const inboundSchema = AccountAnnualIncomeRangeUsd$inboundSchema; /** @deprecated use `AccountAnnualIncomeRangeUsd$outboundSchema` instead. */ export const outboundSchema = AccountAnnualIncomeRangeUsd$outboundSchema; } /** @internal */ export const AccountInvestmentExperience$inboundSchema: z.ZodType< AccountInvestmentExperienceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccountInvestmentExperience), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccountInvestmentExperience$outboundSchema: z.ZodType< AccountInvestmentExperienceOpen, z.ZodTypeDef, AccountInvestmentExperienceOpen > = z.union([ z.nativeEnum(AccountInvestmentExperience), 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 AccountInvestmentExperience$ { /** @deprecated use `AccountInvestmentExperience$inboundSchema` instead. */ export const inboundSchema = AccountInvestmentExperience$inboundSchema; /** @deprecated use `AccountInvestmentExperience$outboundSchema` instead. */ export const outboundSchema = AccountInvestmentExperience$outboundSchema; } /** @internal */ export const AccountLiquidNetWorthRangeUsd$inboundSchema: z.ZodType< AccountLiquidNetWorthRangeUsdOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccountLiquidNetWorthRangeUsd), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccountLiquidNetWorthRangeUsd$outboundSchema: z.ZodType< AccountLiquidNetWorthRangeUsdOpen, z.ZodTypeDef, AccountLiquidNetWorthRangeUsdOpen > = z.union([ z.nativeEnum(AccountLiquidNetWorthRangeUsd), 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 AccountLiquidNetWorthRangeUsd$ { /** @deprecated use `AccountLiquidNetWorthRangeUsd$inboundSchema` instead. */ export const inboundSchema = AccountLiquidNetWorthRangeUsd$inboundSchema; /** @deprecated use `AccountLiquidNetWorthRangeUsd$outboundSchema` instead. */ export const outboundSchema = AccountLiquidNetWorthRangeUsd$outboundSchema; } /** @internal */ export const AccountTotalNetWorthRangeUsd$inboundSchema: z.ZodType< AccountTotalNetWorthRangeUsdOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccountTotalNetWorthRangeUsd), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccountTotalNetWorthRangeUsd$outboundSchema: z.ZodType< AccountTotalNetWorthRangeUsdOpen, z.ZodTypeDef, AccountTotalNetWorthRangeUsdOpen > = z.union([ z.nativeEnum(AccountTotalNetWorthRangeUsd), 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 AccountTotalNetWorthRangeUsd$ { /** @deprecated use `AccountTotalNetWorthRangeUsd$inboundSchema` instead. */ export const inboundSchema = AccountTotalNetWorthRangeUsd$inboundSchema; /** @deprecated use `AccountTotalNetWorthRangeUsd$outboundSchema` instead. */ export const outboundSchema = AccountTotalNetWorthRangeUsd$outboundSchema; } /** @internal */ export const CustomerProfile$inboundSchema: z.ZodType< CustomerProfile, z.ZodTypeDef, unknown > = z.object({ annual_income_range_usd: AccountAnnualIncomeRangeUsd$inboundSchema.optional(), federal_tax_bracket: z.number().optional(), investment_experience: AccountInvestmentExperience$inboundSchema.optional(), liquid_net_worth_range_usd: AccountLiquidNetWorthRangeUsd$inboundSchema .optional(), total_net_worth_range_usd: AccountTotalNetWorthRangeUsd$inboundSchema .optional(), }).transform((v) => { return remap$(v, { "annual_income_range_usd": "annualIncomeRangeUsd", "federal_tax_bracket": "federalTaxBracket", "investment_experience": "investmentExperience", "liquid_net_worth_range_usd": "liquidNetWorthRangeUsd", "total_net_worth_range_usd": "totalNetWorthRangeUsd", }); }); /** @internal */ export type CustomerProfile$Outbound = { annual_income_range_usd?: string | undefined; federal_tax_bracket?: number | undefined; investment_experience?: string | undefined; liquid_net_worth_range_usd?: string | undefined; total_net_worth_range_usd?: string | undefined; }; /** @internal */ export const CustomerProfile$outboundSchema: z.ZodType< CustomerProfile$Outbound, z.ZodTypeDef, CustomerProfile > = z.object({ annualIncomeRangeUsd: AccountAnnualIncomeRangeUsd$outboundSchema.optional(), federalTaxBracket: z.number().optional(), investmentExperience: AccountInvestmentExperience$outboundSchema.optional(), liquidNetWorthRangeUsd: AccountLiquidNetWorthRangeUsd$outboundSchema .optional(), totalNetWorthRangeUsd: AccountTotalNetWorthRangeUsd$outboundSchema.optional(), }).transform((v) => { return remap$(v, { annualIncomeRangeUsd: "annual_income_range_usd", federalTaxBracket: "federal_tax_bracket", investmentExperience: "investment_experience", liquidNetWorthRangeUsd: "liquid_net_worth_range_usd", totalNetWorthRangeUsd: "total_net_worth_range_usd", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CustomerProfile$ { /** @deprecated use `CustomerProfile$inboundSchema` instead. */ export const inboundSchema = CustomerProfile$inboundSchema; /** @deprecated use `CustomerProfile$outboundSchema` instead. */ export const outboundSchema = CustomerProfile$outboundSchema; /** @deprecated use `CustomerProfile$Outbound` instead. */ export type Outbound = CustomerProfile$Outbound; } export function customerProfileToJSON( customerProfile: CustomerProfile, ): string { return JSON.stringify(CustomerProfile$outboundSchema.parse(customerProfile)); } export function customerProfileFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CustomerProfile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CustomerProfile' from JSON`, ); } /** @internal */ export const InvestmentProfile$inboundSchema: z.ZodType< InvestmentProfile, z.ZodTypeDef, unknown > = z.object({ account_goals: z.nullable(z.lazy(() => AccountGoals$inboundSchema)) .optional(), customer_profile: z.nullable(z.lazy(() => CustomerProfile$inboundSchema)) .optional(), investment_profile_id: z.string().optional(), }).transform((v) => { return remap$(v, { "account_goals": "accountGoals", "customer_profile": "customerProfile", "investment_profile_id": "investmentProfileId", }); }); /** @internal */ export type InvestmentProfile$Outbound = { account_goals?: AccountGoals$Outbound | null | undefined; customer_profile?: CustomerProfile$Outbound | null | undefined; investment_profile_id?: string | undefined; }; /** @internal */ export const InvestmentProfile$outboundSchema: z.ZodType< InvestmentProfile$Outbound, z.ZodTypeDef, InvestmentProfile > = z.object({ accountGoals: z.nullable(z.lazy(() => AccountGoals$outboundSchema)) .optional(), customerProfile: z.nullable(z.lazy(() => CustomerProfile$outboundSchema)) .optional(), investmentProfileId: z.string().optional(), }).transform((v) => { return remap$(v, { accountGoals: "account_goals", customerProfile: "customer_profile", investmentProfileId: "investment_profile_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace InvestmentProfile$ { /** @deprecated use `InvestmentProfile$inboundSchema` instead. */ export const inboundSchema = InvestmentProfile$inboundSchema; /** @deprecated use `InvestmentProfile$outboundSchema` instead. */ export const outboundSchema = InvestmentProfile$outboundSchema; /** @deprecated use `InvestmentProfile$Outbound` instead. */ export type Outbound = InvestmentProfile$Outbound; } export function investmentProfileToJSON( investmentProfile: InvestmentProfile, ): string { return JSON.stringify( InvestmentProfile$outboundSchema.parse(investmentProfile), ); } export function investmentProfileFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InvestmentProfile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InvestmentProfile' from JSON`, ); } /** @internal */ export const OwnershipType$inboundSchema: z.ZodType< OwnershipTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OwnershipType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OwnershipType$outboundSchema: z.ZodType< OwnershipTypeOpen, z.ZodTypeDef, OwnershipTypeOpen > = z.union([ z.nativeEnum(OwnershipType), 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 OwnershipType$ { /** @deprecated use `OwnershipType$inboundSchema` instead. */ export const inboundSchema = OwnershipType$inboundSchema; /** @deprecated use `OwnershipType$outboundSchema` instead. */ export const outboundSchema = OwnershipType$outboundSchema; } /** @internal */ export const RegistrationType$inboundSchema: z.ZodType< RegistrationTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(RegistrationType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const RegistrationType$outboundSchema: z.ZodType< RegistrationTypeOpen, z.ZodTypeDef, RegistrationTypeOpen > = z.union([ z.nativeEnum(RegistrationType), 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 RegistrationType$ { /** @deprecated use `RegistrationType$inboundSchema` instead. */ export const inboundSchema = RegistrationType$inboundSchema; /** @deprecated use `RegistrationType$outboundSchema` instead. */ export const outboundSchema = RegistrationType$outboundSchema; } /** @internal */ export const ReserveClass$inboundSchema: z.ZodType< ReserveClassOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(ReserveClass), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const ReserveClass$outboundSchema: z.ZodType< ReserveClassOpen, z.ZodTypeDef, ReserveClassOpen > = z.union([ z.nativeEnum(ReserveClass), 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 ReserveClass$ { /** @deprecated use `ReserveClass$inboundSchema` instead. */ export const inboundSchema = ReserveClass$inboundSchema; /** @deprecated use `ReserveClass$outboundSchema` instead. */ export const outboundSchema = ReserveClass$outboundSchema; } /** @internal */ export const AccountState$inboundSchema: z.ZodType< AccountStateOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccountState), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccountState$outboundSchema: z.ZodType< AccountStateOpen, z.ZodTypeDef, AccountStateOpen > = z.union([ z.nativeEnum(AccountState), 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 AccountState$ { /** @deprecated use `AccountState$inboundSchema` instead. */ export const inboundSchema = AccountState$inboundSchema; /** @deprecated use `AccountState$outboundSchema` instead. */ export const outboundSchema = AccountState$outboundSchema; } /** @internal */ export const AccountCostBasisLotDisposalMethod$inboundSchema: z.ZodType< AccountCostBasisLotDisposalMethodOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AccountCostBasisLotDisposalMethod), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AccountCostBasisLotDisposalMethod$outboundSchema: z.ZodType< AccountCostBasisLotDisposalMethodOpen, z.ZodTypeDef, AccountCostBasisLotDisposalMethodOpen > = z.union([ z.nativeEnum(AccountCostBasisLotDisposalMethod), 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 AccountCostBasisLotDisposalMethod$ { /** @deprecated use `AccountCostBasisLotDisposalMethod$inboundSchema` instead. */ export const inboundSchema = AccountCostBasisLotDisposalMethod$inboundSchema; /** @deprecated use `AccountCostBasisLotDisposalMethod$outboundSchema` instead. */ export const outboundSchema = AccountCostBasisLotDisposalMethod$outboundSchema; } /** @internal */ export const AccountTaxProfile$inboundSchema: z.ZodType< AccountTaxProfile, z.ZodTypeDef, unknown > = z.object({ cost_basis_lot_disposal_method: AccountCostBasisLotDisposalMethod$inboundSchema.optional(), section_475_election: z.boolean().optional(), }).transform((v) => { return remap$(v, { "cost_basis_lot_disposal_method": "costBasisLotDisposalMethod", "section_475_election": "section475Election", }); }); /** @internal */ export type AccountTaxProfile$Outbound = { cost_basis_lot_disposal_method?: string | undefined; section_475_election?: boolean | undefined; }; /** @internal */ export const AccountTaxProfile$outboundSchema: z.ZodType< AccountTaxProfile$Outbound, z.ZodTypeDef, AccountTaxProfile > = z.object({ costBasisLotDisposalMethod: AccountCostBasisLotDisposalMethod$outboundSchema .optional(), section475Election: z.boolean().optional(), }).transform((v) => { return remap$(v, { costBasisLotDisposalMethod: "cost_basis_lot_disposal_method", section475Election: "section_475_election", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountTaxProfile$ { /** @deprecated use `AccountTaxProfile$inboundSchema` instead. */ export const inboundSchema = AccountTaxProfile$inboundSchema; /** @deprecated use `AccountTaxProfile$outboundSchema` instead. */ export const outboundSchema = AccountTaxProfile$outboundSchema; /** @deprecated use `AccountTaxProfile$Outbound` instead. */ export type Outbound = AccountTaxProfile$Outbound; } export function accountTaxProfileToJSON( accountTaxProfile: AccountTaxProfile, ): string { return JSON.stringify( AccountTaxProfile$outboundSchema.parse(accountTaxProfile), ); } export function accountTaxProfileFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountTaxProfile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountTaxProfile' from JSON`, ); } /** @internal */ export const Account$inboundSchema: z.ZodType = z.object({ accepts_issuer_direct_communication: z.boolean().optional(), account_group_id: z.string().optional(), account_id: z.string().optional(), account_number: z.string().optional(), active_restrictions: z.array(z.string()).optional(), advised: z.boolean().optional(), agreements: z.array(Agreement$inboundSchema).optional(), cat_account_holder_type: AccountCatAccountHolderType$inboundSchema .optional(), cat_reporter_information: z.nullable( z.lazy(() => CatReporterInformation$inboundSchema), ).optional(), cftc_owner_type: CftcOwnerType$inboundSchema.optional(), client_account_id: z.string().optional(), close_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), correspondent_id: z.string().optional(), create_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), domicile: Domicile$inboundSchema.optional(), enrollments: z.array(Enrollment$inboundSchema).optional(), fdid: z.string().optional(), finra_coa_code: FinraCoaCode$inboundSchema.optional(), funding_type: FundingType$inboundSchema.optional(), identifiers: z.array(Identifier$inboundSchema).optional(), interested_parties: z.array(InterestedParty$inboundSchema).optional(), investment_profile: z.nullable( z.lazy(() => InvestmentProfile$inboundSchema), ).optional(), managed: z.boolean().optional(), margin_group_id: z.string().optional(), name: z.string().optional(), open_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), originating_account_id: z.string().optional(), ownership_type: OwnershipType$inboundSchema.optional(), parties: z.array(Party$inboundSchema).optional(), pattern_day_trader: z.boolean().optional(), primary_registered_rep_id: z.string().optional(), registration_type: RegistrationType$inboundSchema.optional(), reserve_class: ReserveClass$inboundSchema.optional(), state: AccountState$inboundSchema.optional(), tax_profile: z.nullable(z.lazy(() => AccountTaxProfile$inboundSchema)) .optional(), title: z.string().optional(), trusted_contacts: z.array(TrustedContact$inboundSchema).optional(), wrap_fee_billed: z.boolean().optional(), }).transform((v) => { return remap$(v, { "accepts_issuer_direct_communication": "acceptsIssuerDirectCommunication", "account_group_id": "accountGroupId", "account_id": "accountId", "account_number": "accountNumber", "active_restrictions": "activeRestrictions", "cat_account_holder_type": "catAccountHolderType", "cat_reporter_information": "catReporterInformation", "cftc_owner_type": "cftcOwnerType", "client_account_id": "clientAccountId", "close_time": "closeTime", "correspondent_id": "correspondentId", "create_time": "createTime", "finra_coa_code": "finraCoaCode", "funding_type": "fundingType", "interested_parties": "interestedParties", "investment_profile": "investmentProfile", "margin_group_id": "marginGroupId", "open_time": "openTime", "originating_account_id": "originatingAccountId", "ownership_type": "ownershipType", "pattern_day_trader": "patternDayTrader", "primary_registered_rep_id": "primaryRegisteredRepId", "registration_type": "registrationType", "reserve_class": "reserveClass", "tax_profile": "taxProfile", "trusted_contacts": "trustedContacts", "wrap_fee_billed": "wrapFeeBilled", }); }); /** @internal */ export type Account$Outbound = { accepts_issuer_direct_communication?: boolean | undefined; account_group_id?: string | undefined; account_id?: string | undefined; account_number?: string | undefined; active_restrictions?: Array | undefined; advised?: boolean | undefined; agreements?: Array | undefined; cat_account_holder_type?: string | undefined; cat_reporter_information?: CatReporterInformation$Outbound | null | undefined; cftc_owner_type?: string | undefined; client_account_id?: string | undefined; close_time?: string | null | undefined; correspondent_id?: string | undefined; create_time?: string | null | undefined; domicile?: string | undefined; enrollments?: Array | undefined; fdid?: string | undefined; finra_coa_code?: string | undefined; funding_type?: string | undefined; identifiers?: Array | undefined; interested_parties?: Array | undefined; investment_profile?: InvestmentProfile$Outbound | null | undefined; managed?: boolean | undefined; margin_group_id?: string | undefined; name?: string | undefined; open_time?: string | null | undefined; originating_account_id?: string | undefined; ownership_type?: string | undefined; parties?: Array | undefined; pattern_day_trader?: boolean | undefined; primary_registered_rep_id?: string | undefined; registration_type?: string | undefined; reserve_class?: string | undefined; state?: string | undefined; tax_profile?: AccountTaxProfile$Outbound | null | undefined; title?: string | undefined; trusted_contacts?: Array | undefined; wrap_fee_billed?: boolean | undefined; }; /** @internal */ export const Account$outboundSchema: z.ZodType< Account$Outbound, z.ZodTypeDef, Account > = z.object({ acceptsIssuerDirectCommunication: z.boolean().optional(), accountGroupId: z.string().optional(), accountId: z.string().optional(), accountNumber: z.string().optional(), activeRestrictions: z.array(z.string()).optional(), advised: z.boolean().optional(), agreements: z.array(Agreement$outboundSchema).optional(), catAccountHolderType: AccountCatAccountHolderType$outboundSchema.optional(), catReporterInformation: z.nullable( z.lazy(() => CatReporterInformation$outboundSchema), ).optional(), cftcOwnerType: CftcOwnerType$outboundSchema.optional(), clientAccountId: z.string().optional(), closeTime: z.nullable(z.date().transform(v => v.toISOString())).optional(), correspondentId: z.string().optional(), createTime: z.nullable(z.date().transform(v => v.toISOString())).optional(), domicile: Domicile$outboundSchema.optional(), enrollments: z.array(Enrollment$outboundSchema).optional(), fdid: z.string().optional(), finraCoaCode: FinraCoaCode$outboundSchema.optional(), fundingType: FundingType$outboundSchema.optional(), identifiers: z.array(Identifier$outboundSchema).optional(), interestedParties: z.array(InterestedParty$outboundSchema).optional(), investmentProfile: z.nullable(z.lazy(() => InvestmentProfile$outboundSchema)) .optional(), managed: z.boolean().optional(), marginGroupId: z.string().optional(), name: z.string().optional(), openTime: z.nullable(z.date().transform(v => v.toISOString())).optional(), originatingAccountId: z.string().optional(), ownershipType: OwnershipType$outboundSchema.optional(), parties: z.array(Party$outboundSchema).optional(), patternDayTrader: z.boolean().optional(), primaryRegisteredRepId: z.string().optional(), registrationType: RegistrationType$outboundSchema.optional(), reserveClass: ReserveClass$outboundSchema.optional(), state: AccountState$outboundSchema.optional(), taxProfile: z.nullable(z.lazy(() => AccountTaxProfile$outboundSchema)) .optional(), title: z.string().optional(), trustedContacts: z.array(TrustedContact$outboundSchema).optional(), wrapFeeBilled: z.boolean().optional(), }).transform((v) => { return remap$(v, { acceptsIssuerDirectCommunication: "accepts_issuer_direct_communication", accountGroupId: "account_group_id", accountId: "account_id", accountNumber: "account_number", activeRestrictions: "active_restrictions", catAccountHolderType: "cat_account_holder_type", catReporterInformation: "cat_reporter_information", cftcOwnerType: "cftc_owner_type", clientAccountId: "client_account_id", closeTime: "close_time", correspondentId: "correspondent_id", createTime: "create_time", finraCoaCode: "finra_coa_code", fundingType: "funding_type", interestedParties: "interested_parties", investmentProfile: "investment_profile", marginGroupId: "margin_group_id", openTime: "open_time", originatingAccountId: "originating_account_id", ownershipType: "ownership_type", patternDayTrader: "pattern_day_trader", primaryRegisteredRepId: "primary_registered_rep_id", registrationType: "registration_type", reserveClass: "reserve_class", taxProfile: "tax_profile", trustedContacts: "trusted_contacts", wrapFeeBilled: "wrap_fee_billed", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Account$ { /** @deprecated use `Account$inboundSchema` instead. */ export const inboundSchema = Account$inboundSchema; /** @deprecated use `Account$outboundSchema` instead. */ export const outboundSchema = Account$outboundSchema; /** @deprecated use `Account$Outbound` instead. */ export type Outbound = Account$Outbound; } export function accountToJSON(account: Account): string { return JSON.stringify(Account$outboundSchema.parse(account)); } export function accountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Account$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Account' from JSON`, ); }