/* * 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 { DateCreate, DateCreate$inboundSchema, DateCreate$Outbound, DateCreate$outboundSchema, } from "./datecreate.js"; import { EmploymentCreate, EmploymentCreate$inboundSchema, EmploymentCreate$Outbound, EmploymentCreate$outboundSchema, } from "./employmentcreate.js"; import { ForeignIdentificationCreate, ForeignIdentificationCreate$inboundSchema, ForeignIdentificationCreate$Outbound, ForeignIdentificationCreate$outboundSchema, } from "./foreignidentificationcreate.js"; import { IdentityVerificationResultCreate, IdentityVerificationResultCreate$inboundSchema, IdentityVerificationResultCreate$Outbound, IdentityVerificationResultCreate$outboundSchema, } from "./identityverificationresultcreate.js"; import { LargeTraderCreate, LargeTraderCreate$inboundSchema, LargeTraderCreate$Outbound, LargeTraderCreate$outboundSchema, } from "./largetradercreate.js"; import { NaturalPersonFddCreate, NaturalPersonFddCreate$inboundSchema, NaturalPersonFddCreate$Outbound, NaturalPersonFddCreate$outboundSchema, } from "./naturalpersonfddcreate.js"; import { NonCitizenResidencyCreate, NonCitizenResidencyCreate$inboundSchema, NonCitizenResidencyCreate$Outbound, NonCitizenResidencyCreate$outboundSchema, } from "./noncitizenresidencycreate.js"; import { PostalAddressCreate, PostalAddressCreate$inboundSchema, PostalAddressCreate$Outbound, PostalAddressCreate$outboundSchema, } from "./postaladdresscreate.js"; import { TaxProfileCreate, TaxProfileCreate$inboundSchema, TaxProfileCreate$Outbound, TaxProfileCreate$outboundSchema, } from "./taxprofilecreate.js"; /** * The legal marital status of an account-holder; Used in combination with state of domicile to determine qualification for account types and beneficiary exclusion rules. */ export enum MaritalStatus { MaritalStatusUnspecified = "MARITAL_STATUS_UNSPECIFIED", Single = "SINGLE", Married = "MARRIED", Divorced = "DIVORCED", Widowed = "WIDOWED", } /** * The legal marital status of an account-holder; Used in combination with state of domicile to determine qualification for account types and beneficiary exclusion rules. */ export type MaritalStatusOpen = OpenEnum; /** * The suffix of a natural person; A suffix in a name is any part of the name that comes after the last name */ export enum NameSuffix { NameSuffixUnspecified = "NAME_SUFFIX_UNSPECIFIED", Sr = "SR", Jr = "JR", Iii = "III", Iv = "IV", V = "V", } /** * The suffix of a natural person; A suffix in a name is any part of the name that comes after the last name */ export type NameSuffixOpen = OpenEnum; /** * The nature of the U.S. Tax ID indicated in the related tax_id field; Examples include ITIN, SSN, EIN. */ export enum TaxIdType { TaxIdTypeUnspecified = "TAX_ID_TYPE_UNSPECIFIED", TaxIdTypeSsn = "TAX_ID_TYPE_SSN", TaxIdTypeItin = "TAX_ID_TYPE_ITIN", TaxIdTypeEin = "TAX_ID_TYPE_EIN", } /** * The nature of the U.S. Tax ID indicated in the related tax_id field; Examples include ITIN, SSN, EIN. */ export type TaxIdTypeOpen = OpenEnum; /** * A legal natural person. This represents the full set of data for an individual. A Customer Identification Program (CIP) may be run on legal natural persons. */ export type LegalNaturalPersonCreate = { /** * Indicates whether the person is an accredited investor. By default, this is set to `false`. */ accreditedInvestor?: boolean | undefined; /** * Indicates whether the person is an adviser. By default, this is set to `false`. */ adviser?: boolean | undefined; /** * Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * * @remarks * * * A full date, with non-zero year, month, and day values * A month and day value, with a zero year, such as an anniversary * A year on its own, with zero month and day values * A year and month value, with a zero day, such as a credit card expiration date * * Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and `google.protobuf.Timestamp`. */ birthDate: DateCreate; /** * This is used for tax (treaty) and country block list considerations Maximum list of two 2-char CLDR Code citizenship countries, e.g. US, CA */ citizenshipCountries: Array; /** * An external identifier for the legal natural person. This identifier does not have internal uniqueness constraints. */ clientPersonId?: string | undefined; /** * A list of ticker symbols in which the underlying person is a control person; control persons are defined as having significant influence over a company’s management and operations, typically through ownership of a large percentage of the company’s voting stock or through positions on the company’s board of directors or executive team */ controlPersonCompanySymbols?: string | undefined; /** * Indicates the related owner record is an employee of the clearing broker's correspondent customer. By default, this is set to `false`. */ correspondentEmployee?: boolean | undefined; /** * A unique identifier referencing a Correspondent; A Client may have several operating Correspondents within its purview. */ correspondentId: string; /** * Customer identification id returned by the customer identification service which represents a single instance of an identity verification outcome for the specified customer. This verification result will be used as part of the full investigation. */ customerIdentificationId?: string | undefined; /** * Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * * @remarks * * * A full date, with non-zero year, month, and day values * A month and day value, with a zero year, such as an anniversary * A year on its own, with zero month and day values * A year and month value, with a zero day, such as a credit card expiration date * * Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and `google.protobuf.Timestamp`. */ deathDate?: DateCreate | undefined; /** * DBA (Doing Business As) names. Can list up to 5 associated with the Legal Natural Person */ doingBusinessAs?: Array | undefined; /** * Object containing information pertaining to a investor's current employer including the name, address, and duration of employment. */ employment: EmploymentCreate; /** * Family name of a natural person. */ familyName: string; /** * The name of the FINRA-associated entity the underlying natural person is affiliated with. */ finraAssociatedEntity?: string | undefined; /** * Foreign identification */ foreignIdentification?: ForeignIdentificationCreate | undefined; /** * The given name of a natural person; Conventionally known as 'first name' in most English-speaking countries. */ givenName: string; /** * An identity verification result that clients may supply. This result represents data and confirmation attesting to identity verification. */ identityVerificationResult?: IdentityVerificationResultCreate | undefined; /** * Indicates whether the person is an institutional customer. By default, this is set to `false`. */ institutionalCustomer?: boolean | undefined; /** * A large trader. */ largeTrader?: LargeTraderCreate | undefined; /** * The legal marital status of an account-holder; Used in combination with state of domicile to determine qualification for account types and beneficiary exclusion rules. */ maritalStatus?: MaritalStatusOpen | undefined; /** * Non-primary names representing a natural person; Name attributed to a person other than "Given" and "Family" names. */ middleNames?: string | undefined; /** * The suffix of a natural person; A suffix in a name is any part of the name that comes after the last name */ nameSuffix?: NameSuffixOpen | undefined; /** * Foreign Due Diligence for Legal Natural Persons required when a Legal Natural Person is the Primary Owner on a non-resident/non-citizen Account. */ naturalPersonFdd?: NaturalPersonFddCreate | undefined; /** * Non Citizenship Residency to facilitate non-Citizen lawful US residents to open domestic accounts. */ nonCitizenResidency?: NonCitizenResidencyCreate | undefined; /** * Represents a postal address, e.g. for postal delivery or payments addresses. Given a postal address, a postal service can deliver items to a premise, P.O. Box or similar. It is not intended to model geographical locations (roads, towns, mountains). * * @remarks * * In typical usage an address would be created via user input or from importing existing data, depending on the type of process. * * Advice on address input / editing: - Use an i18n-ready address widget such as https://github.com/google/libaddressinput) - Users should not be presented with UI elements for input or editing of fields outside countries where that field is used. * * For more guidance on how to use this schema, please see: https://support.google.com/business/answer/6397478 */ personalAddress: PostalAddressCreate; /** * A Party's self-disclosed list of names representing family members who are politically exposed. */ politicallyExposedImmediateFamilyNames?: Array | undefined; /** * A Party's self-disclosed list of named politically exposed organizations they are personally associated with. */ politicallyExposedOrganization?: string | undefined; /** * Boolean indicator whether the LNP is subject to backup withholding. By default, this is set to `false`. */ subjectToBackupWithholding?: boolean | undefined; /** * The full U.S. tax ID for a related person; Must be provided with `ITIN` or `SSN` tax ID type */ taxId?: string | undefined; /** * The nature of the U.S. Tax ID indicated in the related tax_id field; Examples include ITIN, SSN, EIN. */ taxIdType?: TaxIdTypeOpen | undefined; /** * Tax Profile pertaining to the Legal Entity or Natural Person. */ taxProfile: TaxProfileCreate; }; /** @internal */ export const MaritalStatus$inboundSchema: z.ZodType< MaritalStatusOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(MaritalStatus), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const MaritalStatus$outboundSchema: z.ZodType< MaritalStatusOpen, z.ZodTypeDef, MaritalStatusOpen > = z.union([ z.nativeEnum(MaritalStatus), 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 MaritalStatus$ { /** @deprecated use `MaritalStatus$inboundSchema` instead. */ export const inboundSchema = MaritalStatus$inboundSchema; /** @deprecated use `MaritalStatus$outboundSchema` instead. */ export const outboundSchema = MaritalStatus$outboundSchema; } /** @internal */ export const NameSuffix$inboundSchema: z.ZodType< NameSuffixOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(NameSuffix), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const NameSuffix$outboundSchema: z.ZodType< NameSuffixOpen, z.ZodTypeDef, NameSuffixOpen > = z.union([ z.nativeEnum(NameSuffix), 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 NameSuffix$ { /** @deprecated use `NameSuffix$inboundSchema` instead. */ export const inboundSchema = NameSuffix$inboundSchema; /** @deprecated use `NameSuffix$outboundSchema` instead. */ export const outboundSchema = NameSuffix$outboundSchema; } /** @internal */ export const TaxIdType$inboundSchema: z.ZodType< TaxIdTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TaxIdType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TaxIdType$outboundSchema: z.ZodType< TaxIdTypeOpen, z.ZodTypeDef, TaxIdTypeOpen > = z.union([ z.nativeEnum(TaxIdType), 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 TaxIdType$ { /** @deprecated use `TaxIdType$inboundSchema` instead. */ export const inboundSchema = TaxIdType$inboundSchema; /** @deprecated use `TaxIdType$outboundSchema` instead. */ export const outboundSchema = TaxIdType$outboundSchema; } /** @internal */ export const LegalNaturalPersonCreate$inboundSchema: z.ZodType< LegalNaturalPersonCreate, z.ZodTypeDef, unknown > = z.object({ accredited_investor: z.boolean().optional(), adviser: z.boolean().optional(), birth_date: DateCreate$inboundSchema, citizenship_countries: z.array(z.string()), client_person_id: z.string().optional(), control_person_company_symbols: z.string().optional(), correspondent_employee: z.boolean().optional(), correspondent_id: z.string(), customer_identification_id: z.string().optional(), death_date: DateCreate$inboundSchema.optional(), doing_business_as: z.array(z.string()).optional(), employment: EmploymentCreate$inboundSchema, family_name: z.string(), finra_associated_entity: z.string().optional(), foreign_identification: ForeignIdentificationCreate$inboundSchema.optional(), given_name: z.string(), identity_verification_result: IdentityVerificationResultCreate$inboundSchema .optional(), institutional_customer: z.boolean().optional(), large_trader: LargeTraderCreate$inboundSchema.optional(), marital_status: MaritalStatus$inboundSchema.optional(), middle_names: z.string().optional(), name_suffix: NameSuffix$inboundSchema.optional(), natural_person_fdd: NaturalPersonFddCreate$inboundSchema.optional(), non_citizen_residency: NonCitizenResidencyCreate$inboundSchema.optional(), personal_address: PostalAddressCreate$inboundSchema, politically_exposed_immediate_family_names: z.array(z.string()).optional(), politically_exposed_organization: z.string().optional(), subject_to_backup_withholding: z.boolean().optional(), tax_id: z.string().optional(), tax_id_type: TaxIdType$inboundSchema.optional(), tax_profile: TaxProfileCreate$inboundSchema, }).transform((v) => { return remap$(v, { "accredited_investor": "accreditedInvestor", "birth_date": "birthDate", "citizenship_countries": "citizenshipCountries", "client_person_id": "clientPersonId", "control_person_company_symbols": "controlPersonCompanySymbols", "correspondent_employee": "correspondentEmployee", "correspondent_id": "correspondentId", "customer_identification_id": "customerIdentificationId", "death_date": "deathDate", "doing_business_as": "doingBusinessAs", "family_name": "familyName", "finra_associated_entity": "finraAssociatedEntity", "foreign_identification": "foreignIdentification", "given_name": "givenName", "identity_verification_result": "identityVerificationResult", "institutional_customer": "institutionalCustomer", "large_trader": "largeTrader", "marital_status": "maritalStatus", "middle_names": "middleNames", "name_suffix": "nameSuffix", "natural_person_fdd": "naturalPersonFdd", "non_citizen_residency": "nonCitizenResidency", "personal_address": "personalAddress", "politically_exposed_immediate_family_names": "politicallyExposedImmediateFamilyNames", "politically_exposed_organization": "politicallyExposedOrganization", "subject_to_backup_withholding": "subjectToBackupWithholding", "tax_id": "taxId", "tax_id_type": "taxIdType", "tax_profile": "taxProfile", }); }); /** @internal */ export type LegalNaturalPersonCreate$Outbound = { accredited_investor?: boolean | undefined; adviser?: boolean | undefined; birth_date: DateCreate$Outbound; citizenship_countries: Array; client_person_id?: string | undefined; control_person_company_symbols?: string | undefined; correspondent_employee?: boolean | undefined; correspondent_id: string; customer_identification_id?: string | undefined; death_date?: DateCreate$Outbound | undefined; doing_business_as?: Array | undefined; employment: EmploymentCreate$Outbound; family_name: string; finra_associated_entity?: string | undefined; foreign_identification?: ForeignIdentificationCreate$Outbound | undefined; given_name: string; identity_verification_result?: | IdentityVerificationResultCreate$Outbound | undefined; institutional_customer?: boolean | undefined; large_trader?: LargeTraderCreate$Outbound | undefined; marital_status?: string | undefined; middle_names?: string | undefined; name_suffix?: string | undefined; natural_person_fdd?: NaturalPersonFddCreate$Outbound | undefined; non_citizen_residency?: NonCitizenResidencyCreate$Outbound | undefined; personal_address: PostalAddressCreate$Outbound; politically_exposed_immediate_family_names?: Array | undefined; politically_exposed_organization?: string | undefined; subject_to_backup_withholding?: boolean | undefined; tax_id?: string | undefined; tax_id_type?: string | undefined; tax_profile: TaxProfileCreate$Outbound; }; /** @internal */ export const LegalNaturalPersonCreate$outboundSchema: z.ZodType< LegalNaturalPersonCreate$Outbound, z.ZodTypeDef, LegalNaturalPersonCreate > = z.object({ accreditedInvestor: z.boolean().optional(), adviser: z.boolean().optional(), birthDate: DateCreate$outboundSchema, citizenshipCountries: z.array(z.string()), clientPersonId: z.string().optional(), controlPersonCompanySymbols: z.string().optional(), correspondentEmployee: z.boolean().optional(), correspondentId: z.string(), customerIdentificationId: z.string().optional(), deathDate: DateCreate$outboundSchema.optional(), doingBusinessAs: z.array(z.string()).optional(), employment: EmploymentCreate$outboundSchema, familyName: z.string(), finraAssociatedEntity: z.string().optional(), foreignIdentification: ForeignIdentificationCreate$outboundSchema.optional(), givenName: z.string(), identityVerificationResult: IdentityVerificationResultCreate$outboundSchema .optional(), institutionalCustomer: z.boolean().optional(), largeTrader: LargeTraderCreate$outboundSchema.optional(), maritalStatus: MaritalStatus$outboundSchema.optional(), middleNames: z.string().optional(), nameSuffix: NameSuffix$outboundSchema.optional(), naturalPersonFdd: NaturalPersonFddCreate$outboundSchema.optional(), nonCitizenResidency: NonCitizenResidencyCreate$outboundSchema.optional(), personalAddress: PostalAddressCreate$outboundSchema, politicallyExposedImmediateFamilyNames: z.array(z.string()).optional(), politicallyExposedOrganization: z.string().optional(), subjectToBackupWithholding: z.boolean().optional(), taxId: z.string().optional(), taxIdType: TaxIdType$outboundSchema.optional(), taxProfile: TaxProfileCreate$outboundSchema, }).transform((v) => { return remap$(v, { accreditedInvestor: "accredited_investor", birthDate: "birth_date", citizenshipCountries: "citizenship_countries", clientPersonId: "client_person_id", controlPersonCompanySymbols: "control_person_company_symbols", correspondentEmployee: "correspondent_employee", correspondentId: "correspondent_id", customerIdentificationId: "customer_identification_id", deathDate: "death_date", doingBusinessAs: "doing_business_as", familyName: "family_name", finraAssociatedEntity: "finra_associated_entity", foreignIdentification: "foreign_identification", givenName: "given_name", identityVerificationResult: "identity_verification_result", institutionalCustomer: "institutional_customer", largeTrader: "large_trader", maritalStatus: "marital_status", middleNames: "middle_names", nameSuffix: "name_suffix", naturalPersonFdd: "natural_person_fdd", nonCitizenResidency: "non_citizen_residency", personalAddress: "personal_address", politicallyExposedImmediateFamilyNames: "politically_exposed_immediate_family_names", politicallyExposedOrganization: "politically_exposed_organization", subjectToBackupWithholding: "subject_to_backup_withholding", taxId: "tax_id", taxIdType: "tax_id_type", taxProfile: "tax_profile", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LegalNaturalPersonCreate$ { /** @deprecated use `LegalNaturalPersonCreate$inboundSchema` instead. */ export const inboundSchema = LegalNaturalPersonCreate$inboundSchema; /** @deprecated use `LegalNaturalPersonCreate$outboundSchema` instead. */ export const outboundSchema = LegalNaturalPersonCreate$outboundSchema; /** @deprecated use `LegalNaturalPersonCreate$Outbound` instead. */ export type Outbound = LegalNaturalPersonCreate$Outbound; } export function legalNaturalPersonCreateToJSON( legalNaturalPersonCreate: LegalNaturalPersonCreate, ): string { return JSON.stringify( LegalNaturalPersonCreate$outboundSchema.parse(legalNaturalPersonCreate), ); } export function legalNaturalPersonCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LegalNaturalPersonCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LegalNaturalPersonCreate' from JSON`, ); }