/* * 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"; /** * Describes the contents of a document and how it is used */ export enum DocumentDocumentType { AccountDocumentTypeUnspecified = "ACCOUNT_DOCUMENT_TYPE_UNSPECIFIED", CertificateOfAppointment = "CERTIFICATE_OF_APPOINTMENT", FdicSweepProgramAgreement = "FDIC_SWEEP_PROGRAM_AGREEMENT", FpslMasterServicesLoanAgreement = "FPSL_MASTER_SERVICES_LOAN_AGREEMENT", TransferOnDeathBeneficiaryDesignation = "TRANSFER_ON_DEATH_BENEFICIARY_DESIGNATION", ChangeOfAddress = "CHANGE_OF_ADDRESS", NewAccountForm = "NEW_ACCOUNT_FORM", Letter3210 = "LETTER_3210", IraApplForm = "IRA_APPL_FORM", RiaIraApplForm = "RIA_IRA_APPL_FORM", IraDepositForm = "IRA_DEPOSIT_FORM", RiaIraDepositForm = "RIA_IRA_DEPOSIT_FORM", IraDistForm = "IRA_DIST_FORM", RiaIraDistForm = "RIA_IRA_DIST_FORM", RothApplForm = "ROTH_APPL_FORM", RiaRothApplForm = "RIA_ROTH_APPL_FORM", RothDistForm = "ROTH_DIST_FORM", RiaRothDistForm = "RIA_ROTH_DIST_FORM", SimpleContTransm = "SIMPLE_CONT_TRANSM", EsaApplForm = "ESA_APPL_FORM", EsaWthdrStatement = "ESA_WTHDR_STATEMENT", DirConvForm = "DIR_CONV_FORM", IraBeneForm = "IRA_BENE_FORM", IraJrnlForm = "IRA_JRNL_FORM", SepEmplPlanDoc = "SEP_EMPL_PLAN_DOC", SimpleAdoptAgreement = "SIMPLE_ADOPT_AGREEMENT", SimpleApplForm = "SIMPLE_APPL_FORM", DeathCertification = "DEATH_CERTIFICATION", AchAgreement = "ACH_AGREEMENT", ApexSelectApplication = "APEX_SELECT_APPLICATION", AsaDirectDeposit = "ASA_DIRECT_DEPOSIT", BankingMisc = "BANKING_MISC", AccTransferForm = "ACC_TRANSFER_FORM", AddressVerificationNotice = "ADDRESS_VERIFICATION_NOTICE", AffidavitOfDomicile = "AFFIDAVIT_OF_DOMICILE", ApexSimpleDirectDeposit = "APEX_SIMPLE_DIRECT_DEPOSIT", TransferForm = "TRANSFER_FORM", JournalRequestForm = "JOURNAL_REQUEST_FORM", Check = "CHECK", CheckRequestForm = "CHECK_REQUEST_FORM", CorpAgreementCash = "CORP_AGREEMENT_CASH", CorpResolution = "CORP_RESOLUTION", CourtDocument = "COURT_DOCUMENT", CourtOrder = "COURT_ORDER", DepositSecuritiesRequestForm = "DEPOSIT_SECURITIES_REQUEST_FORM", DigitalSignature = "DIGITAL_SIGNATURE", DirectConversionRequest = "DIRECT_CONVERSION_REQUEST", DistributionForm = "DISTRIBUTION_FORM", DocumentIrs = "DOCUMENT_IRS", DomesticWire = "DOMESTIC_WIRE", DwacRequestForm = "DWAC_REQUEST_FORM", Dwre = "DWRE", EntityDueDiligenceQuestionnaire = "ENTITY_DUE_DILIGENCE_QUESTIONNAIRE", EntityUpdateForm = "ENTITY_UPDATE_FORM", EscheatForm = "ESCHEAT_FORM", EscheatmentDueDiligenceLetter = "ESCHEATMENT_DUE_DILIGENCE_LETTER", ESignature = "E_SIGNATURE", ForeignAccountDueDiligenceQuestionnaire = "FOREIGN_ACCOUNT_DUE_DILIGENCE_QUESTIONNAIRE", ForeignBankCertificationDisclosure = "FOREIGN_BANK_CERTIFICATION_DISCLOSURE", ForeignEntityDeclarationForm = "FOREIGN_ENTITY_DECLARATION_FORM", ForeignFinInstDueDiligenceQuestionnaire = "FOREIGN_FIN_INST_DUE_DILIGENCE_QUESTIONNAIRE", Form144 = "FORM_144", FreeDeliveryForm = "FREE_DELIVERY_FORM", FullTradingAuthorization = "FULL_TRADING_AUTHORIZATION", InternationalWireRequestForm = "INTERNATIONAL_WIRE_REQUEST_FORM", IrrevocableStockBondPower = "IRREVOCABLE_STOCK_BOND_POWER", JointAccAgreementEntirety = "JOINT_ACC_AGREEMENT_ENTIRETY", JointAccAgreementRightsOfSurvivorship = "JOINT_ACC_AGREEMENT_RIGHTS_OF_SURVIVORSHIP", JointAccAgreementCommunityProperty = "JOINT_ACC_AGREEMENT_COMMUNITY_PROPERTY", JointAccAgreementTenantsInCommon = "JOINT_ACC_AGREEMENT_TENANTS_IN_COMMON", JointTefraW8 = "JOINT_TEFRA_W8", LegalOpinion = "LEGAL_OPINION", LetterOfAuthority = "LETTER_OF_AUTHORITY", LettersOfTestamentaryCertAppointment = "LETTERS_OF_TESTAMENTARY_CERT_APPOINTMENT", LimitedLiabilityCompanyAgreement = "LIMITED_LIABILITY_COMPANY_AGREEMENT", LimitedPurposeMargin = "LIMITED_PURPOSE_MARGIN", MailAuthorization = "MAIL_AUTHORIZATION", Msla = "MSLA", MiscGeneral = "MISC_GENERAL", NewAccountApplicationEntity = "NEW_ACCOUNT_APPLICATION_ENTITY", NonCorporateAssociation = "NON_CORPORATE_ASSOCIATION", PartnershipAgreement = "PARTNERSHIP_AGREEMENT", PatternDayTraderForm = "PATTERN_DAY_TRADER_FORM", PowerOfAttorneyDurable = "POWER_OF_ATTORNEY_DURABLE", PowerOfAttorneyGeneral = "POWER_OF_ATTORNEY_GENERAL", RegisteredAdvisoryAuthorityForm = "REGISTERED_ADVISORY_AUTHORITY_FORM", Rmd = "RMD", RiskDisclosure = "RISK_DISCLOSURE", Rule145SellersLetter = "RULE_145_SELLERS_LETTER", Rule701Letter = "RULE_701_LETTER", SameNameLoa = "SAME_NAME_LOA", SecuritiesBasedLendingAgreement = "SECURITIES_BASED_LENDING_AGREEMENT", SepContributionAgreement = "SEP_CONTRIBUTION_AGREEMENT", SepEmployerPlanDocumentation = "SEP_EMPLOYER_PLAN_DOCUMENTATION", SignatureCard = "SIGNATURE_CARD", SimpleForm5304 = "SIMPLE_FORM_5304", SimplifiedEmployeePension = "SIMPLIFIED_EMPLOYEE_PENSION", CertificateSoleProprietorship = "CERTIFICATE_SOLE_PROPRIETORSHIP", TransferOnDeath = "TRANSFER_ON_DEATH", TrustAgreement = "TRUST_AGREEMENT", TaxW8Ben = "TAX_W8_BEN", TaxW8BenJointAccountHolder = "TAX_W8_BEN_JOINT_ACCOUNT_HOLDER", TaxW8Eci = "TAX_W8_ECI", TaxW8Exp = "TAX_W8_EXP", TaxW8Imy = "TAX_W8_IMY", TaxW9 = "TAX_W9", WillCopy = "WILL_COPY", WireRequestForm = "WIRE_REQUEST_FORM", WorthlessSecurities = "WORTHLESS_SECURITIES", ChangeOfAddressRequest = "CHANGE_OF_ADDRESS_REQUEST", OptionsAgreement = "OPTIONS_AGREEMENT", StateWaiverForm = "STATE_WAIVER_FORM", AltsSubscriptionAgreement = "ALTS_SUBSCRIPTION_AGREEMENT", } /** * Describes the contents of a document and how it is used */ export type DocumentDocumentTypeOpen = OpenEnum; /** * Date that the document was uploaded */ export type UploadedDate = { /** * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */ day?: number | undefined; /** * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */ month?: number | undefined; /** * Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */ year?: number | undefined; }; /** * Fields specific to an account document */ export type AccountDocument = { /** * Identifies the account relevant to the document */ accountId?: string | undefined; /** * Describes the contents of a document and how it is used */ documentType?: DocumentDocumentTypeOpen | undefined; /** * Date that the document was uploaded */ uploadedDate?: UploadedDate | null | undefined; }; /** * Describes the contents of a document and how it is used */ export enum DocumentIdDocumentDocumentType { IdDocumentTypeUnspecified = "ID_DOCUMENT_TYPE_UNSPECIFIED", BirthCertificate = "BIRTH_CERTIFICATE", CustomerIdentificationProcess = "CUSTOMER_IDENTIFICATION_PROCESS", DeathCertificate = "DEATH_CERTIFICATE", DrivingLicense = "DRIVING_LICENSE", EmployerConsentForm407Letter = "EMPLOYER_CONSENT_FORM_407_LETTER", MarriageCertificate = "MARRIAGE_CERTIFICATE", Passport = "PASSPORT", ProofOfTaxId = "PROOF_OF_TAX_ID", SocialSecurityDocument = "SOCIAL_SECURITY_DOCUMENT", ThirdPartyCipResults = "THIRD_PARTY_CIP_RESULTS", StateIdCard = "STATE_ID_CARD", NationalIdCard = "NATIONAL_ID_CARD", PermanentResidentVisa = "PERMANENT_RESIDENT_VISA", IrisItinLetter = "IRIS_ITIN_LETTER", UtilityBill = "UTILITY_BILL", MilitaryIdCard = "MILITARY_ID_CARD", MortgageStatement = "MORTGAGE_STATEMENT", LeaseAgreement = "LEASE_AGREEMENT", ExecutorCertification = "EXECUTOR_CERTIFICATION", TrusteeCertification = "TRUSTEE_CERTIFICATION", Selfie = "SELFIE", CertOfSoleOfficer = "CERT_OF_SOLE_OFFICER", CertificationCorrespondentAccounts = "CERTIFICATION_CORRESPONDENT_ACCOUNTS", CertificationForeignBanks = "CERTIFICATION_FOREIGN_BANKS", CharterArticlesOfIncorporation = "CHARTER_ARTICLES_OF_INCORPORATION", DivorceDecree = "DIVORCE_DECREE", ProofOfResidence = "PROOF_OF_RESIDENCE", BoReportingExemptionProof = "BO_REPORTING_EXEMPTION_PROOF", OperatingAgreement = "OPERATING_AGREEMENT", RegisterOfMembers = "REGISTER_OF_MEMBERS", BoardResolution = "BOARD_RESOLUTION", TrustDeedsAgreement = "TRUST_DEEDS_AGREEMENT", CorporateBylaws = "CORPORATE_BYLAWS", ShareholderAgreement = "SHAREHOLDER_AGREEMENT", CorporateRecords = "CORPORATE_RECORDS", ArticlesOfOrganization = "ARTICLES_OF_ORGANIZATION", } /** * Describes the contents of a document and how it is used */ export type DocumentIdDocumentDocumentTypeOpen = OpenEnum< typeof DocumentIdDocumentDocumentType >; /** * Date that the document was uploaded */ export type DocumentUploadedDate = { /** * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */ day?: number | undefined; /** * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */ month?: number | undefined; /** * Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */ year?: number | undefined; }; /** * Fields specific to an identity document */ export type IdDocument = { /** * Describes the contents of a document and how it is used */ documentType?: DocumentIdDocumentDocumentTypeOpen | undefined; /** * Identifies the legal natural person relevant to the document */ legalNaturalPersonId?: string | undefined; /** * Date that the document was uploaded */ uploadedDate?: DocumentUploadedDate | null | undefined; }; /** * Describes the contents of a document and how it is used */ export enum DocumentInvestorDocumentDocumentType { InvestorDocumentTypeUnspecified = "INVESTOR_DOCUMENT_TYPE_UNSPECIFIED", ConfirmDaily = "CONFIRM_DAILY", ConfirmMonthly = "CONFIRM_MONTHLY", FormConsolidated1099 = "FORM_CONSOLIDATED_1099", Form1042S = "FORM_1042_S", Form1099Q = "FORM_1099_Q", Form1099R = "FORM_1099_R", Form2439 = "FORM_2439", Form4806A = "FORM_480_6A", Form4806B = "FORM_480_6B", Form5498 = "FORM_5498", StatementMonthly = "STATEMENT_MONTHLY", StatementQuarterly = "STATEMENT_QUARTERLY", Form1099C = "FORM_1099_C", Form4806D = "FORM_480_6D", Form5498Esa = "FORM_5498_ESA", FpslNegativeConsentForm = "FPSL_NEGATIVE_CONSENT_FORM", CrsForm = "CRS_FORM", FpslConfirmation = "FPSL_CONFIRMATION", } /** * Describes the contents of a document and how it is used */ export type DocumentInvestorDocumentDocumentTypeOpen = OpenEnum< typeof DocumentInvestorDocumentDocumentType >; /** * Date that the related activities were processed */ export type DocumentProcessDate = { /** * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */ day?: number | undefined; /** * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */ month?: number | undefined; /** * Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */ year?: number | undefined; }; /** * Fields specific to an investor document */ export type InvestorDocument = { /** * Identifies the account relevant to the document */ accountId?: string | undefined; /** * Describes the contents of a document and how it is used */ documentType?: DocumentInvestorDocumentDocumentTypeOpen | undefined; /** * Date that the related activities were processed */ processDate?: DocumentProcessDate | null | undefined; }; /** * Describes a document that has been uploaded to Apex storage. */ export type Document = { /** * Fields specific to an account document */ accountDocument?: AccountDocument | null | undefined; /** * Identifies the correspondent relevant to the document */ correspondentId?: string | undefined; /** * Signed link used to download a document; The link expires one hour after being generated */ downloadLink?: string | undefined; /** * Fields specific to an identity document */ idDocument?: IdDocument | null | undefined; /** * Fields specific to an investor document */ investorDocument?: InvestorDocument | null | undefined; /** * Identifier for the document */ name?: string | undefined; }; /** @internal */ export const DocumentDocumentType$inboundSchema: z.ZodType< DocumentDocumentTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(DocumentDocumentType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const DocumentDocumentType$outboundSchema: z.ZodType< DocumentDocumentTypeOpen, z.ZodTypeDef, DocumentDocumentTypeOpen > = z.union([ z.nativeEnum(DocumentDocumentType), 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 DocumentDocumentType$ { /** @deprecated use `DocumentDocumentType$inboundSchema` instead. */ export const inboundSchema = DocumentDocumentType$inboundSchema; /** @deprecated use `DocumentDocumentType$outboundSchema` instead. */ export const outboundSchema = DocumentDocumentType$outboundSchema; } /** @internal */ export const UploadedDate$inboundSchema: z.ZodType< UploadedDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type UploadedDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const UploadedDate$outboundSchema: z.ZodType< UploadedDate$Outbound, z.ZodTypeDef, UploadedDate > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace UploadedDate$ { /** @deprecated use `UploadedDate$inboundSchema` instead. */ export const inboundSchema = UploadedDate$inboundSchema; /** @deprecated use `UploadedDate$outboundSchema` instead. */ export const outboundSchema = UploadedDate$outboundSchema; /** @deprecated use `UploadedDate$Outbound` instead. */ export type Outbound = UploadedDate$Outbound; } export function uploadedDateToJSON(uploadedDate: UploadedDate): string { return JSON.stringify(UploadedDate$outboundSchema.parse(uploadedDate)); } export function uploadedDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => UploadedDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UploadedDate' from JSON`, ); } /** @internal */ export const AccountDocument$inboundSchema: z.ZodType< AccountDocument, z.ZodTypeDef, unknown > = z.object({ account_id: z.string().optional(), document_type: DocumentDocumentType$inboundSchema.optional(), uploaded_date: z.nullable(z.lazy(() => UploadedDate$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "account_id": "accountId", "document_type": "documentType", "uploaded_date": "uploadedDate", }); }); /** @internal */ export type AccountDocument$Outbound = { account_id?: string | undefined; document_type?: string | undefined; uploaded_date?: UploadedDate$Outbound | null | undefined; }; /** @internal */ export const AccountDocument$outboundSchema: z.ZodType< AccountDocument$Outbound, z.ZodTypeDef, AccountDocument > = z.object({ accountId: z.string().optional(), documentType: DocumentDocumentType$outboundSchema.optional(), uploadedDate: z.nullable(z.lazy(() => UploadedDate$outboundSchema)) .optional(), }).transform((v) => { return remap$(v, { accountId: "account_id", documentType: "document_type", uploadedDate: "uploaded_date", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AccountDocument$ { /** @deprecated use `AccountDocument$inboundSchema` instead. */ export const inboundSchema = AccountDocument$inboundSchema; /** @deprecated use `AccountDocument$outboundSchema` instead. */ export const outboundSchema = AccountDocument$outboundSchema; /** @deprecated use `AccountDocument$Outbound` instead. */ export type Outbound = AccountDocument$Outbound; } export function accountDocumentToJSON( accountDocument: AccountDocument, ): string { return JSON.stringify(AccountDocument$outboundSchema.parse(accountDocument)); } export function accountDocumentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AccountDocument$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountDocument' from JSON`, ); } /** @internal */ export const DocumentIdDocumentDocumentType$inboundSchema: z.ZodType< DocumentIdDocumentDocumentTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(DocumentIdDocumentDocumentType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const DocumentIdDocumentDocumentType$outboundSchema: z.ZodType< DocumentIdDocumentDocumentTypeOpen, z.ZodTypeDef, DocumentIdDocumentDocumentTypeOpen > = z.union([ z.nativeEnum(DocumentIdDocumentDocumentType), 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 DocumentIdDocumentDocumentType$ { /** @deprecated use `DocumentIdDocumentDocumentType$inboundSchema` instead. */ export const inboundSchema = DocumentIdDocumentDocumentType$inboundSchema; /** @deprecated use `DocumentIdDocumentDocumentType$outboundSchema` instead. */ export const outboundSchema = DocumentIdDocumentDocumentType$outboundSchema; } /** @internal */ export const DocumentUploadedDate$inboundSchema: z.ZodType< DocumentUploadedDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type DocumentUploadedDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const DocumentUploadedDate$outboundSchema: z.ZodType< DocumentUploadedDate$Outbound, z.ZodTypeDef, DocumentUploadedDate > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DocumentUploadedDate$ { /** @deprecated use `DocumentUploadedDate$inboundSchema` instead. */ export const inboundSchema = DocumentUploadedDate$inboundSchema; /** @deprecated use `DocumentUploadedDate$outboundSchema` instead. */ export const outboundSchema = DocumentUploadedDate$outboundSchema; /** @deprecated use `DocumentUploadedDate$Outbound` instead. */ export type Outbound = DocumentUploadedDate$Outbound; } export function documentUploadedDateToJSON( documentUploadedDate: DocumentUploadedDate, ): string { return JSON.stringify( DocumentUploadedDate$outboundSchema.parse(documentUploadedDate), ); } export function documentUploadedDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DocumentUploadedDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DocumentUploadedDate' from JSON`, ); } /** @internal */ export const IdDocument$inboundSchema: z.ZodType< IdDocument, z.ZodTypeDef, unknown > = z.object({ document_type: DocumentIdDocumentDocumentType$inboundSchema.optional(), legal_natural_person_id: z.string().optional(), uploaded_date: z.nullable(z.lazy(() => DocumentUploadedDate$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "document_type": "documentType", "legal_natural_person_id": "legalNaturalPersonId", "uploaded_date": "uploadedDate", }); }); /** @internal */ export type IdDocument$Outbound = { document_type?: string | undefined; legal_natural_person_id?: string | undefined; uploaded_date?: DocumentUploadedDate$Outbound | null | undefined; }; /** @internal */ export const IdDocument$outboundSchema: z.ZodType< IdDocument$Outbound, z.ZodTypeDef, IdDocument > = z.object({ documentType: DocumentIdDocumentDocumentType$outboundSchema.optional(), legalNaturalPersonId: z.string().optional(), uploadedDate: z.nullable(z.lazy(() => DocumentUploadedDate$outboundSchema)) .optional(), }).transform((v) => { return remap$(v, { documentType: "document_type", legalNaturalPersonId: "legal_natural_person_id", uploadedDate: "uploaded_date", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace IdDocument$ { /** @deprecated use `IdDocument$inboundSchema` instead. */ export const inboundSchema = IdDocument$inboundSchema; /** @deprecated use `IdDocument$outboundSchema` instead. */ export const outboundSchema = IdDocument$outboundSchema; /** @deprecated use `IdDocument$Outbound` instead. */ export type Outbound = IdDocument$Outbound; } export function idDocumentToJSON(idDocument: IdDocument): string { return JSON.stringify(IdDocument$outboundSchema.parse(idDocument)); } export function idDocumentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IdDocument$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IdDocument' from JSON`, ); } /** @internal */ export const DocumentInvestorDocumentDocumentType$inboundSchema: z.ZodType< DocumentInvestorDocumentDocumentTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(DocumentInvestorDocumentDocumentType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const DocumentInvestorDocumentDocumentType$outboundSchema: z.ZodType< DocumentInvestorDocumentDocumentTypeOpen, z.ZodTypeDef, DocumentInvestorDocumentDocumentTypeOpen > = z.union([ z.nativeEnum(DocumentInvestorDocumentDocumentType), 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 DocumentInvestorDocumentDocumentType$ { /** @deprecated use `DocumentInvestorDocumentDocumentType$inboundSchema` instead. */ export const inboundSchema = DocumentInvestorDocumentDocumentType$inboundSchema; /** @deprecated use `DocumentInvestorDocumentDocumentType$outboundSchema` instead. */ export const outboundSchema = DocumentInvestorDocumentDocumentType$outboundSchema; } /** @internal */ export const DocumentProcessDate$inboundSchema: z.ZodType< DocumentProcessDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type DocumentProcessDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const DocumentProcessDate$outboundSchema: z.ZodType< DocumentProcessDate$Outbound, z.ZodTypeDef, DocumentProcessDate > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DocumentProcessDate$ { /** @deprecated use `DocumentProcessDate$inboundSchema` instead. */ export const inboundSchema = DocumentProcessDate$inboundSchema; /** @deprecated use `DocumentProcessDate$outboundSchema` instead. */ export const outboundSchema = DocumentProcessDate$outboundSchema; /** @deprecated use `DocumentProcessDate$Outbound` instead. */ export type Outbound = DocumentProcessDate$Outbound; } export function documentProcessDateToJSON( documentProcessDate: DocumentProcessDate, ): string { return JSON.stringify( DocumentProcessDate$outboundSchema.parse(documentProcessDate), ); } export function documentProcessDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DocumentProcessDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DocumentProcessDate' from JSON`, ); } /** @internal */ export const InvestorDocument$inboundSchema: z.ZodType< InvestorDocument, z.ZodTypeDef, unknown > = z.object({ account_id: z.string().optional(), document_type: DocumentInvestorDocumentDocumentType$inboundSchema.optional(), process_date: z.nullable(z.lazy(() => DocumentProcessDate$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "account_id": "accountId", "document_type": "documentType", "process_date": "processDate", }); }); /** @internal */ export type InvestorDocument$Outbound = { account_id?: string | undefined; document_type?: string | undefined; process_date?: DocumentProcessDate$Outbound | null | undefined; }; /** @internal */ export const InvestorDocument$outboundSchema: z.ZodType< InvestorDocument$Outbound, z.ZodTypeDef, InvestorDocument > = z.object({ accountId: z.string().optional(), documentType: DocumentInvestorDocumentDocumentType$outboundSchema.optional(), processDate: z.nullable(z.lazy(() => DocumentProcessDate$outboundSchema)) .optional(), }).transform((v) => { return remap$(v, { accountId: "account_id", documentType: "document_type", processDate: "process_date", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace InvestorDocument$ { /** @deprecated use `InvestorDocument$inboundSchema` instead. */ export const inboundSchema = InvestorDocument$inboundSchema; /** @deprecated use `InvestorDocument$outboundSchema` instead. */ export const outboundSchema = InvestorDocument$outboundSchema; /** @deprecated use `InvestorDocument$Outbound` instead. */ export type Outbound = InvestorDocument$Outbound; } export function investorDocumentToJSON( investorDocument: InvestorDocument, ): string { return JSON.stringify( InvestorDocument$outboundSchema.parse(investorDocument), ); } export function investorDocumentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InvestorDocument$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InvestorDocument' from JSON`, ); } /** @internal */ export const Document$inboundSchema: z.ZodType< Document, z.ZodTypeDef, unknown > = z.object({ account_document: z.nullable(z.lazy(() => AccountDocument$inboundSchema)) .optional(), correspondent_id: z.string().optional(), download_link: z.string().optional(), id_document: z.nullable(z.lazy(() => IdDocument$inboundSchema)).optional(), investor_document: z.nullable(z.lazy(() => InvestorDocument$inboundSchema)) .optional(), name: z.string().optional(), }).transform((v) => { return remap$(v, { "account_document": "accountDocument", "correspondent_id": "correspondentId", "download_link": "downloadLink", "id_document": "idDocument", "investor_document": "investorDocument", }); }); /** @internal */ export type Document$Outbound = { account_document?: AccountDocument$Outbound | null | undefined; correspondent_id?: string | undefined; download_link?: string | undefined; id_document?: IdDocument$Outbound | null | undefined; investor_document?: InvestorDocument$Outbound | null | undefined; name?: string | undefined; }; /** @internal */ export const Document$outboundSchema: z.ZodType< Document$Outbound, z.ZodTypeDef, Document > = z.object({ accountDocument: z.nullable(z.lazy(() => AccountDocument$outboundSchema)) .optional(), correspondentId: z.string().optional(), downloadLink: z.string().optional(), idDocument: z.nullable(z.lazy(() => IdDocument$outboundSchema)).optional(), investorDocument: z.nullable(z.lazy(() => InvestorDocument$outboundSchema)) .optional(), name: z.string().optional(), }).transform((v) => { return remap$(v, { accountDocument: "account_document", correspondentId: "correspondent_id", downloadLink: "download_link", idDocument: "id_document", investorDocument: "investor_document", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Document$ { /** @deprecated use `Document$inboundSchema` instead. */ export const inboundSchema = Document$inboundSchema; /** @deprecated use `Document$outboundSchema` instead. */ export const outboundSchema = Document$outboundSchema; /** @deprecated use `Document$Outbound` instead. */ export type Outbound = Document$Outbound; } export function documentToJSON(document: Document): string { return JSON.stringify(Document$outboundSchema.parse(document)); } export function documentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Document$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Document' from JSON`, ); }