/* * 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 { DateUpdate, DateUpdate$inboundSchema, DateUpdate$Outbound, DateUpdate$outboundSchema, } from "./dateupdate.js"; import { EmploymentUpdate, EmploymentUpdate$inboundSchema, EmploymentUpdate$Outbound, EmploymentUpdate$outboundSchema, } from "./employmentupdate.js"; import { ForeignIdentificationUpdate, ForeignIdentificationUpdate$inboundSchema, ForeignIdentificationUpdate$Outbound, ForeignIdentificationUpdate$outboundSchema, } from "./foreignidentificationupdate.js"; import { IdentityVerificationResultUpdate, IdentityVerificationResultUpdate$inboundSchema, IdentityVerificationResultUpdate$Outbound, IdentityVerificationResultUpdate$outboundSchema, } from "./identityverificationresultupdate.js"; import { LargeTraderUpdate, LargeTraderUpdate$inboundSchema, LargeTraderUpdate$Outbound, LargeTraderUpdate$outboundSchema, } from "./largetraderupdate.js"; import { NaturalPersonFddUpdate, NaturalPersonFddUpdate$inboundSchema, NaturalPersonFddUpdate$Outbound, NaturalPersonFddUpdate$outboundSchema, } from "./naturalpersonfddupdate.js"; import { NonCitizenResidencyUpdate, NonCitizenResidencyUpdate$inboundSchema, NonCitizenResidencyUpdate$Outbound, NonCitizenResidencyUpdate$outboundSchema, } from "./noncitizenresidencyupdate.js"; import { PostalAddressUpdate, PostalAddressUpdate$inboundSchema, PostalAddressUpdate$Outbound, PostalAddressUpdate$outboundSchema, } from "./postaladdressupdate.js"; import { TaxProfileUpdate, TaxProfileUpdate$inboundSchema, TaxProfileUpdate$Outbound, TaxProfileUpdate$outboundSchema, } from "./taxprofileupdate.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 LegalNaturalPersonUpdateMaritalStatus { 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 LegalNaturalPersonUpdateMaritalStatusOpen = OpenEnum< typeof LegalNaturalPersonUpdateMaritalStatus >; /** * 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 LegalNaturalPersonUpdateNameSuffix { 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 LegalNaturalPersonUpdateNameSuffixOpen = OpenEnum< typeof LegalNaturalPersonUpdateNameSuffix >; /** * The nature of the U.S. Tax ID indicated in the related tax_id field; Examples include ITIN, SSN, EIN. */ export enum LegalNaturalPersonUpdateTaxIdType { 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 LegalNaturalPersonUpdateTaxIdTypeOpen = OpenEnum< typeof LegalNaturalPersonUpdateTaxIdType >; /** * 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 LegalNaturalPersonUpdate = { /** * 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?: DateUpdate | undefined; /** * 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 | undefined; /** * 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 | undefined; /** * 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?: DateUpdate | 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?: EmploymentUpdate | undefined; /** * Family name of a natural person. */ familyName?: string | undefined; /** * The name of the FINRA-associated entity the underlying natural person is affiliated with. */ finraAssociatedEntity?: string | undefined; /** * Foreign identification */ foreignIdentification?: ForeignIdentificationUpdate | undefined; /** * The given name of a natural person; Conventionally known as 'first name' in most English-speaking countries. */ givenName?: string | undefined; /** * An identity verification result that clients may supply. This result represents data and confirmation attesting to identity verification. */ identityVerificationResult?: IdentityVerificationResultUpdate | undefined; /** * Indicates whether the person is an institutional customer. By default, this is set to `false`. */ institutionalCustomer?: boolean | undefined; /** * A large trader. */ largeTrader?: LargeTraderUpdate | 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?: LegalNaturalPersonUpdateMaritalStatusOpen | 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?: LegalNaturalPersonUpdateNameSuffixOpen | 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?: NaturalPersonFddUpdate | undefined; /** * Non Citizenship Residency to facilitate non-Citizen lawful US residents to open domestic accounts. */ nonCitizenResidency?: NonCitizenResidencyUpdate | 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?: PostalAddressUpdate | undefined; /** * 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?: LegalNaturalPersonUpdateTaxIdTypeOpen | undefined; /** * Tax Profile pertaining to the Legal Entity or Natural Person. */ taxProfile?: TaxProfileUpdate | undefined; }; /** @internal */ export const LegalNaturalPersonUpdateMaritalStatus$inboundSchema: z.ZodType< LegalNaturalPersonUpdateMaritalStatusOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(LegalNaturalPersonUpdateMaritalStatus), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const LegalNaturalPersonUpdateMaritalStatus$outboundSchema: z.ZodType< LegalNaturalPersonUpdateMaritalStatusOpen, z.ZodTypeDef, LegalNaturalPersonUpdateMaritalStatusOpen > = z.union([ z.nativeEnum(LegalNaturalPersonUpdateMaritalStatus), 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 LegalNaturalPersonUpdateMaritalStatus$ { /** @deprecated use `LegalNaturalPersonUpdateMaritalStatus$inboundSchema` instead. */ export const inboundSchema = LegalNaturalPersonUpdateMaritalStatus$inboundSchema; /** @deprecated use `LegalNaturalPersonUpdateMaritalStatus$outboundSchema` instead. */ export const outboundSchema = LegalNaturalPersonUpdateMaritalStatus$outboundSchema; } /** @internal */ export const LegalNaturalPersonUpdateNameSuffix$inboundSchema: z.ZodType< LegalNaturalPersonUpdateNameSuffixOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(LegalNaturalPersonUpdateNameSuffix), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const LegalNaturalPersonUpdateNameSuffix$outboundSchema: z.ZodType< LegalNaturalPersonUpdateNameSuffixOpen, z.ZodTypeDef, LegalNaturalPersonUpdateNameSuffixOpen > = z.union([ z.nativeEnum(LegalNaturalPersonUpdateNameSuffix), 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 LegalNaturalPersonUpdateNameSuffix$ { /** @deprecated use `LegalNaturalPersonUpdateNameSuffix$inboundSchema` instead. */ export const inboundSchema = LegalNaturalPersonUpdateNameSuffix$inboundSchema; /** @deprecated use `LegalNaturalPersonUpdateNameSuffix$outboundSchema` instead. */ export const outboundSchema = LegalNaturalPersonUpdateNameSuffix$outboundSchema; } /** @internal */ export const LegalNaturalPersonUpdateTaxIdType$inboundSchema: z.ZodType< LegalNaturalPersonUpdateTaxIdTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(LegalNaturalPersonUpdateTaxIdType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const LegalNaturalPersonUpdateTaxIdType$outboundSchema: z.ZodType< LegalNaturalPersonUpdateTaxIdTypeOpen, z.ZodTypeDef, LegalNaturalPersonUpdateTaxIdTypeOpen > = z.union([ z.nativeEnum(LegalNaturalPersonUpdateTaxIdType), 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 LegalNaturalPersonUpdateTaxIdType$ { /** @deprecated use `LegalNaturalPersonUpdateTaxIdType$inboundSchema` instead. */ export const inboundSchema = LegalNaturalPersonUpdateTaxIdType$inboundSchema; /** @deprecated use `LegalNaturalPersonUpdateTaxIdType$outboundSchema` instead. */ export const outboundSchema = LegalNaturalPersonUpdateTaxIdType$outboundSchema; } /** @internal */ export const LegalNaturalPersonUpdate$inboundSchema: z.ZodType< LegalNaturalPersonUpdate, z.ZodTypeDef, unknown > = z.object({ accredited_investor: z.boolean().optional(), adviser: z.boolean().optional(), birth_date: DateUpdate$inboundSchema.optional(), citizenship_countries: z.array(z.string()).optional(), client_person_id: z.string().optional(), control_person_company_symbols: z.string().optional(), correspondent_employee: z.boolean().optional(), correspondent_id: z.string().optional(), customer_identification_id: z.string().optional(), death_date: DateUpdate$inboundSchema.optional(), doing_business_as: z.array(z.string()).optional(), employment: EmploymentUpdate$inboundSchema.optional(), family_name: z.string().optional(), finra_associated_entity: z.string().optional(), foreign_identification: ForeignIdentificationUpdate$inboundSchema.optional(), given_name: z.string().optional(), identity_verification_result: IdentityVerificationResultUpdate$inboundSchema .optional(), institutional_customer: z.boolean().optional(), large_trader: LargeTraderUpdate$inboundSchema.optional(), marital_status: LegalNaturalPersonUpdateMaritalStatus$inboundSchema .optional(), middle_names: z.string().optional(), name_suffix: LegalNaturalPersonUpdateNameSuffix$inboundSchema.optional(), natural_person_fdd: NaturalPersonFddUpdate$inboundSchema.optional(), non_citizen_residency: NonCitizenResidencyUpdate$inboundSchema.optional(), personal_address: PostalAddressUpdate$inboundSchema.optional(), 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: LegalNaturalPersonUpdateTaxIdType$inboundSchema.optional(), tax_profile: TaxProfileUpdate$inboundSchema.optional(), }).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 LegalNaturalPersonUpdate$Outbound = { accredited_investor?: boolean | undefined; adviser?: boolean | undefined; birth_date?: DateUpdate$Outbound | undefined; citizenship_countries?: Array | undefined; client_person_id?: string | undefined; control_person_company_symbols?: string | undefined; correspondent_employee?: boolean | undefined; correspondent_id?: string | undefined; customer_identification_id?: string | undefined; death_date?: DateUpdate$Outbound | undefined; doing_business_as?: Array | undefined; employment?: EmploymentUpdate$Outbound | undefined; family_name?: string | undefined; finra_associated_entity?: string | undefined; foreign_identification?: ForeignIdentificationUpdate$Outbound | undefined; given_name?: string | undefined; identity_verification_result?: | IdentityVerificationResultUpdate$Outbound | undefined; institutional_customer?: boolean | undefined; large_trader?: LargeTraderUpdate$Outbound | undefined; marital_status?: string | undefined; middle_names?: string | undefined; name_suffix?: string | undefined; natural_person_fdd?: NaturalPersonFddUpdate$Outbound | undefined; non_citizen_residency?: NonCitizenResidencyUpdate$Outbound | undefined; personal_address?: PostalAddressUpdate$Outbound | undefined; 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?: TaxProfileUpdate$Outbound | undefined; }; /** @internal */ export const LegalNaturalPersonUpdate$outboundSchema: z.ZodType< LegalNaturalPersonUpdate$Outbound, z.ZodTypeDef, LegalNaturalPersonUpdate > = z.object({ accreditedInvestor: z.boolean().optional(), adviser: z.boolean().optional(), birthDate: DateUpdate$outboundSchema.optional(), citizenshipCountries: z.array(z.string()).optional(), clientPersonId: z.string().optional(), controlPersonCompanySymbols: z.string().optional(), correspondentEmployee: z.boolean().optional(), correspondentId: z.string().optional(), customerIdentificationId: z.string().optional(), deathDate: DateUpdate$outboundSchema.optional(), doingBusinessAs: z.array(z.string()).optional(), employment: EmploymentUpdate$outboundSchema.optional(), familyName: z.string().optional(), finraAssociatedEntity: z.string().optional(), foreignIdentification: ForeignIdentificationUpdate$outboundSchema.optional(), givenName: z.string().optional(), identityVerificationResult: IdentityVerificationResultUpdate$outboundSchema .optional(), institutionalCustomer: z.boolean().optional(), largeTrader: LargeTraderUpdate$outboundSchema.optional(), maritalStatus: LegalNaturalPersonUpdateMaritalStatus$outboundSchema .optional(), middleNames: z.string().optional(), nameSuffix: LegalNaturalPersonUpdateNameSuffix$outboundSchema.optional(), naturalPersonFdd: NaturalPersonFddUpdate$outboundSchema.optional(), nonCitizenResidency: NonCitizenResidencyUpdate$outboundSchema.optional(), personalAddress: PostalAddressUpdate$outboundSchema.optional(), politicallyExposedImmediateFamilyNames: z.array(z.string()).optional(), politicallyExposedOrganization: z.string().optional(), subjectToBackupWithholding: z.boolean().optional(), taxId: z.string().optional(), taxIdType: LegalNaturalPersonUpdateTaxIdType$outboundSchema.optional(), taxProfile: TaxProfileUpdate$outboundSchema.optional(), }).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 LegalNaturalPersonUpdate$ { /** @deprecated use `LegalNaturalPersonUpdate$inboundSchema` instead. */ export const inboundSchema = LegalNaturalPersonUpdate$inboundSchema; /** @deprecated use `LegalNaturalPersonUpdate$outboundSchema` instead. */ export const outboundSchema = LegalNaturalPersonUpdate$outboundSchema; /** @deprecated use `LegalNaturalPersonUpdate$Outbound` instead. */ export type Outbound = LegalNaturalPersonUpdate$Outbound; } export function legalNaturalPersonUpdateToJSON( legalNaturalPersonUpdate: LegalNaturalPersonUpdate, ): string { return JSON.stringify( LegalNaturalPersonUpdate$outboundSchema.parse(legalNaturalPersonUpdate), ); } export function legalNaturalPersonUpdateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LegalNaturalPersonUpdate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LegalNaturalPersonUpdate' from JSON`, ); }