/* * 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"; /** * The legal day, month, and year of birth for a beneficiary; Birth date is required if tax id and tax id type is not provided. */ export type BeneficiaryBirthDate = { /** * 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; }; /** * The entity type of the beneficiary; Required if the beneficiary is a legal entity. */ export enum BeneficiaryEntityType { EntityTypeUnspecified = "ENTITY_TYPE_UNSPECIFIED", Corporation = "CORPORATION", LimitedLiabilityCompany = "LIMITED_LIABILITY_COMPANY", Trust = "TRUST", Estate = "ESTATE", } /** * The entity type of the beneficiary; Required if the beneficiary is a legal entity. */ export type BeneficiaryEntityTypeOpen = OpenEnum; /** * The object containing data for the purpose of delivery physical mailings to a party; Typically used for statements, account updates, tax documents, and other postal mailings; May also be used as an alternative identity verification address to personalAddress. Required fields within the `mailing_address` object include: * * @remarks * - `administrative_area` * - `region_code` - 2 character CLDR Code * - `postal_code` * - `locality` * - `address_lines` - max 5 lines */ export type MailingAddress = { /** * Unstructured address lines describing the lower levels of an address. * * @remarks * * Because values in address_lines do not have type information and may sometimes contain multiple values in a single field (e.g. "Austin, TX"), it is important that the line order is clear. The order of address lines should be "envelope order" for the country/region of the address. In places where this can vary (e.g. Japan), address_language is used to make it explicit (e.g. "ja" for large-to-small ordering and "ja-Latn" or "en" for small-to-large). This way, the most specific line of an address can be selected based on the language. * * The minimum permitted structural representation of an address consists of a region_code with all remaining information placed in the address_lines. It would be possible to format such an address very approximately without geocoding, but no semantic reasoning could be made about any of the address components until it was at least partially resolved. * * Creating an address only containing a region_code and address_lines, and then geocoding is the recommended way to handle completely unstructured addresses (as opposed to guessing which parts of the address should be localities or administrative areas). */ addressLines?: Array | undefined; /** * Optional. Highest administrative subdivision which is used for postal addresses of a country or region. For example, this can be a state, a province, an oblast, or a prefecture. Specifically, for Spain this is the province and not the autonomous community (e.g. "Barcelona" and not "Catalonia"). Many countries don't use an administrative area in postal addresses. E.g. in Switzerland this should be left unpopulated. */ administrativeArea?: string | undefined; /** * Optional. BCP-47 language code of the contents of this address (if known). This is often the UI language of the input form or is expected to match one of the languages used in the address' country/region, or their transliterated equivalents. This can affect formatting in certain countries, but is not critical to the correctness of the data and will never affect any validation or other non-formatting related operations. * * @remarks * * If this value is not known, it should be omitted (rather than specifying a possibly incorrect default). * * Examples: "zh-Hant", "ja", "ja-Latn", "en". */ languageCode?: string | undefined; /** * Optional. Generally refers to the city/town portion of the address. Examples: US city, IT comune, UK post town. In regions of the world where localities are not well defined or do not fit into this structure well, leave locality empty and use address_lines. */ locality?: string | undefined; /** * Optional. The name of the organization at the address. */ organization?: string | undefined; /** * Optional. Postal code of the address. Not all countries use or require postal codes to be present, but where they are used, they may trigger additional validation with other parts of the address (e.g. state/zip validation in the U.S.A.). */ postalCode?: string | undefined; /** * Optional. The recipient at the address. This field may, under certain circumstances, contain multiline information. For example, it might contain "care of" information. */ recipients?: Array | undefined; /** * Required. CLDR region code of the country/region of the address. This is never inferred and it is up to the user to ensure the value is correct. See http://cldr.unicode.org/ and http://www.unicode.org/cldr/charts/30/supplemental/territory_information.html for details. Example: "CH" for Switzerland. */ regionCode?: string | undefined; /** * The schema revision of the `PostalAddress`. This must be set to 0, which is the latest revision. * * @remarks * * All new revisions **must** be backward compatible with old revisions. */ revision?: number | undefined; /** * Optional. Additional, country-specific, sorting code. This is not used in most regions. Where it is used, the value is either a string like "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a number alone, representing the "sector code" (Jamaica), "delivery area indicator" (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). */ sortingCode?: string | undefined; /** * Optional. Sublocality of the address. For example, this can be neighborhoods, boroughs, districts. */ sublocality?: string | undefined; }; /** * A short code. * * @remarks * * Reference(s): * - https://en.wikipedia.org/wiki/Short_code */ export type BeneficiaryShortCode = { /** * Required. The short code digits, without a leading plus ('+') or country calling code, e.g. "611". */ number?: string | undefined; /** * Required. The BCP-47 region code of the location where calls to this short code can be made, such as "US" and "BB". * * @remarks * * Reference(s): * - http://www.unicode.org/reports/tr35/#unicode_region_subtag */ regionCode?: string | undefined; }; /** * The phone number for a party; Lives on the party record in the context of the account and does not commute to other accounts held by/for the person */ export type BeneficiaryPhoneNumber = { /** * The phone number, represented as a leading plus sign ('+'), followed by a phone number that uses a relaxed ITU E.164 format consisting of the country calling code (1 to 3 digits) and the subscriber number, with no additional spaces or formatting, e.g.: - correct: "+15552220123" - incorrect: "+1 (555) 222-01234 x123". * * @remarks * * The ITU E.164 format limits the latter to 12 digits, but in practice not all countries respect that, so we relax that restriction here. National-only numbers are not allowed. * * References: - https://www.itu.int/rec/T-REC-E.164-201011-I - https://en.wikipedia.org/wiki/E.164. - https://en.wikipedia.org/wiki/List_of_country_calling_codes */ e164Number?: string | undefined; /** * The phone number's extension. The extension is not standardized in ITU recommendations, except for being defined as a series of numbers with a maximum length of 40 digits. Other than digits, some other dialing characters such as ',' (indicating a wait) or '#' may be stored here. * * @remarks * * Note that no regions currently use extensions with short codes, so this field is normally only set in conjunction with an E.164 number. It is held separately from the E.164 number to allow for short code extensions in the future. */ extension?: string | undefined; /** * A short code. * * @remarks * * Reference(s): * - https://en.wikipedia.org/wiki/Short_code */ shortCode?: BeneficiaryShortCode | null | undefined; }; /** * The relationship of the beneficiary to the account owner */ export enum BeneficiaryRelationType { RelationTypeUnspecified = "RELATION_TYPE_UNSPECIFIED", Spouse = "SPOUSE", Trust = "TRUST", Other = "OTHER", } /** * The relationship of the beneficiary to the account owner */ export type BeneficiaryRelationTypeOpen = OpenEnum< typeof BeneficiaryRelationType >; /** * The nature of the U.S. Tax ID indicated in the related tax_id field; Examples include ITIN, SSN, EIN. Tax id type is required if birth date is not provided. */ export enum BeneficiaryTaxIdType { 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. Tax id type is required if birth date is not provided. */ export type BeneficiaryTaxIdTypeOpen = OpenEnum; /** * The beneficiary for transfer on death. */ export type Beneficiary = { /** * An integer conveying the percentage of interest the related Beneficiary has in the account if the owner(s) become deceased; The sum of all beneficiary percentages must equal "100" */ beneficiaryPercentage?: number | undefined; /** * The legal day, month, and year of birth for a beneficiary; Birth date is required if tax id and tax id type is not provided. */ birthDate?: BeneficiaryBirthDate | null | undefined; /** * Beneficiaries may provide an email, a mailing_address, or both An email address indicated for account communications */ email?: string | undefined; /** * The legal entity name; Required if the beneficiary is a legal entity. */ entityName?: string | undefined; /** * The entity type of the beneficiary; Required if the beneficiary is a legal entity. */ entityType?: BeneficiaryEntityTypeOpen | undefined; /** * Family name of a natural person; Required if the beneficiary is a natural person. */ familyName?: string | undefined; /** * The given name of a natural person; Conventionally known as 'first name' in most English-speaking countries.Required if the beneficiary is a natural person. */ givenName?: string | undefined; /** * The object containing data for the purpose of delivery physical mailings to a party; Typically used for statements, account updates, tax documents, and other postal mailings; May also be used as an alternative identity verification address to personalAddress. Required fields within the `mailing_address` object include: * * @remarks * - `administrative_area` * - `region_code` - 2 character CLDR Code * - `postal_code` * - `locality` * - `address_lines` - max 5 lines */ mailingAddress?: MailingAddress | null | undefined; /** * Non-primary names representing a natural person; Name attributed to a person other than "Given" and "Family" names. */ middleNames?: string | undefined; /** * The phone number for a party; Lives on the party record in the context of the account and does not commute to other accounts held by/for the person */ phoneNumber?: BeneficiaryPhoneNumber | null | undefined; /** * The relationship of the beneficiary to the account owner */ relationType?: BeneficiaryRelationTypeOpen | undefined; /** * The full U.S. tax ID for a related person; Tax ID is required if birth date is not provided. */ taxId?: string | undefined; /** * The nature of the U.S. Tax ID indicated in the related tax_id field; Examples include ITIN, SSN, EIN. Tax id type is required if birth date is not provided. */ taxIdType?: BeneficiaryTaxIdTypeOpen | undefined; }; /** @internal */ export const BeneficiaryBirthDate$inboundSchema: z.ZodType< BeneficiaryBirthDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type BeneficiaryBirthDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const BeneficiaryBirthDate$outboundSchema: z.ZodType< BeneficiaryBirthDate$Outbound, z.ZodTypeDef, BeneficiaryBirthDate > = 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 BeneficiaryBirthDate$ { /** @deprecated use `BeneficiaryBirthDate$inboundSchema` instead. */ export const inboundSchema = BeneficiaryBirthDate$inboundSchema; /** @deprecated use `BeneficiaryBirthDate$outboundSchema` instead. */ export const outboundSchema = BeneficiaryBirthDate$outboundSchema; /** @deprecated use `BeneficiaryBirthDate$Outbound` instead. */ export type Outbound = BeneficiaryBirthDate$Outbound; } export function beneficiaryBirthDateToJSON( beneficiaryBirthDate: BeneficiaryBirthDate, ): string { return JSON.stringify( BeneficiaryBirthDate$outboundSchema.parse(beneficiaryBirthDate), ); } export function beneficiaryBirthDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BeneficiaryBirthDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BeneficiaryBirthDate' from JSON`, ); } /** @internal */ export const BeneficiaryEntityType$inboundSchema: z.ZodType< BeneficiaryEntityTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BeneficiaryEntityType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BeneficiaryEntityType$outboundSchema: z.ZodType< BeneficiaryEntityTypeOpen, z.ZodTypeDef, BeneficiaryEntityTypeOpen > = z.union([ z.nativeEnum(BeneficiaryEntityType), 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 BeneficiaryEntityType$ { /** @deprecated use `BeneficiaryEntityType$inboundSchema` instead. */ export const inboundSchema = BeneficiaryEntityType$inboundSchema; /** @deprecated use `BeneficiaryEntityType$outboundSchema` instead. */ export const outboundSchema = BeneficiaryEntityType$outboundSchema; } /** @internal */ export const MailingAddress$inboundSchema: z.ZodType< MailingAddress, z.ZodTypeDef, unknown > = z.object({ address_lines: z.array(z.string()).optional(), administrative_area: z.string().optional(), language_code: z.string().optional(), locality: z.string().optional(), organization: z.string().optional(), postal_code: z.string().optional(), recipients: z.array(z.string()).optional(), region_code: z.string().optional(), revision: z.number().int().optional(), sorting_code: z.string().optional(), sublocality: z.string().optional(), }).transform((v) => { return remap$(v, { "address_lines": "addressLines", "administrative_area": "administrativeArea", "language_code": "languageCode", "postal_code": "postalCode", "region_code": "regionCode", "sorting_code": "sortingCode", }); }); /** @internal */ export type MailingAddress$Outbound = { address_lines?: Array | undefined; administrative_area?: string | undefined; language_code?: string | undefined; locality?: string | undefined; organization?: string | undefined; postal_code?: string | undefined; recipients?: Array | undefined; region_code?: string | undefined; revision?: number | undefined; sorting_code?: string | undefined; sublocality?: string | undefined; }; /** @internal */ export const MailingAddress$outboundSchema: z.ZodType< MailingAddress$Outbound, z.ZodTypeDef, MailingAddress > = z.object({ addressLines: z.array(z.string()).optional(), administrativeArea: z.string().optional(), languageCode: z.string().optional(), locality: z.string().optional(), organization: z.string().optional(), postalCode: z.string().optional(), recipients: z.array(z.string()).optional(), regionCode: z.string().optional(), revision: z.number().int().optional(), sortingCode: z.string().optional(), sublocality: z.string().optional(), }).transform((v) => { return remap$(v, { addressLines: "address_lines", administrativeArea: "administrative_area", languageCode: "language_code", postalCode: "postal_code", regionCode: "region_code", sortingCode: "sorting_code", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace MailingAddress$ { /** @deprecated use `MailingAddress$inboundSchema` instead. */ export const inboundSchema = MailingAddress$inboundSchema; /** @deprecated use `MailingAddress$outboundSchema` instead. */ export const outboundSchema = MailingAddress$outboundSchema; /** @deprecated use `MailingAddress$Outbound` instead. */ export type Outbound = MailingAddress$Outbound; } export function mailingAddressToJSON(mailingAddress: MailingAddress): string { return JSON.stringify(MailingAddress$outboundSchema.parse(mailingAddress)); } export function mailingAddressFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MailingAddress$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MailingAddress' from JSON`, ); } /** @internal */ export const BeneficiaryShortCode$inboundSchema: z.ZodType< BeneficiaryShortCode, z.ZodTypeDef, unknown > = z.object({ number: z.string().optional(), region_code: z.string().optional(), }).transform((v) => { return remap$(v, { "region_code": "regionCode", }); }); /** @internal */ export type BeneficiaryShortCode$Outbound = { number?: string | undefined; region_code?: string | undefined; }; /** @internal */ export const BeneficiaryShortCode$outboundSchema: z.ZodType< BeneficiaryShortCode$Outbound, z.ZodTypeDef, BeneficiaryShortCode > = z.object({ number: z.string().optional(), regionCode: z.string().optional(), }).transform((v) => { return remap$(v, { regionCode: "region_code", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BeneficiaryShortCode$ { /** @deprecated use `BeneficiaryShortCode$inboundSchema` instead. */ export const inboundSchema = BeneficiaryShortCode$inboundSchema; /** @deprecated use `BeneficiaryShortCode$outboundSchema` instead. */ export const outboundSchema = BeneficiaryShortCode$outboundSchema; /** @deprecated use `BeneficiaryShortCode$Outbound` instead. */ export type Outbound = BeneficiaryShortCode$Outbound; } export function beneficiaryShortCodeToJSON( beneficiaryShortCode: BeneficiaryShortCode, ): string { return JSON.stringify( BeneficiaryShortCode$outboundSchema.parse(beneficiaryShortCode), ); } export function beneficiaryShortCodeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BeneficiaryShortCode$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BeneficiaryShortCode' from JSON`, ); } /** @internal */ export const BeneficiaryPhoneNumber$inboundSchema: z.ZodType< BeneficiaryPhoneNumber, z.ZodTypeDef, unknown > = z.object({ e164_number: z.string().optional(), extension: z.string().optional(), short_code: z.nullable(z.lazy(() => BeneficiaryShortCode$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "e164_number": "e164Number", "short_code": "shortCode", }); }); /** @internal */ export type BeneficiaryPhoneNumber$Outbound = { e164_number?: string | undefined; extension?: string | undefined; short_code?: BeneficiaryShortCode$Outbound | null | undefined; }; /** @internal */ export const BeneficiaryPhoneNumber$outboundSchema: z.ZodType< BeneficiaryPhoneNumber$Outbound, z.ZodTypeDef, BeneficiaryPhoneNumber > = z.object({ e164Number: z.string().optional(), extension: z.string().optional(), shortCode: z.nullable(z.lazy(() => BeneficiaryShortCode$outboundSchema)) .optional(), }).transform((v) => { return remap$(v, { e164Number: "e164_number", shortCode: "short_code", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BeneficiaryPhoneNumber$ { /** @deprecated use `BeneficiaryPhoneNumber$inboundSchema` instead. */ export const inboundSchema = BeneficiaryPhoneNumber$inboundSchema; /** @deprecated use `BeneficiaryPhoneNumber$outboundSchema` instead. */ export const outboundSchema = BeneficiaryPhoneNumber$outboundSchema; /** @deprecated use `BeneficiaryPhoneNumber$Outbound` instead. */ export type Outbound = BeneficiaryPhoneNumber$Outbound; } export function beneficiaryPhoneNumberToJSON( beneficiaryPhoneNumber: BeneficiaryPhoneNumber, ): string { return JSON.stringify( BeneficiaryPhoneNumber$outboundSchema.parse(beneficiaryPhoneNumber), ); } export function beneficiaryPhoneNumberFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BeneficiaryPhoneNumber$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BeneficiaryPhoneNumber' from JSON`, ); } /** @internal */ export const BeneficiaryRelationType$inboundSchema: z.ZodType< BeneficiaryRelationTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BeneficiaryRelationType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BeneficiaryRelationType$outboundSchema: z.ZodType< BeneficiaryRelationTypeOpen, z.ZodTypeDef, BeneficiaryRelationTypeOpen > = z.union([ z.nativeEnum(BeneficiaryRelationType), 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 BeneficiaryRelationType$ { /** @deprecated use `BeneficiaryRelationType$inboundSchema` instead. */ export const inboundSchema = BeneficiaryRelationType$inboundSchema; /** @deprecated use `BeneficiaryRelationType$outboundSchema` instead. */ export const outboundSchema = BeneficiaryRelationType$outboundSchema; } /** @internal */ export const BeneficiaryTaxIdType$inboundSchema: z.ZodType< BeneficiaryTaxIdTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BeneficiaryTaxIdType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BeneficiaryTaxIdType$outboundSchema: z.ZodType< BeneficiaryTaxIdTypeOpen, z.ZodTypeDef, BeneficiaryTaxIdTypeOpen > = z.union([ z.nativeEnum(BeneficiaryTaxIdType), 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 BeneficiaryTaxIdType$ { /** @deprecated use `BeneficiaryTaxIdType$inboundSchema` instead. */ export const inboundSchema = BeneficiaryTaxIdType$inboundSchema; /** @deprecated use `BeneficiaryTaxIdType$outboundSchema` instead. */ export const outboundSchema = BeneficiaryTaxIdType$outboundSchema; } /** @internal */ export const Beneficiary$inboundSchema: z.ZodType< Beneficiary, z.ZodTypeDef, unknown > = z.object({ beneficiary_percentage: z.number().int().optional(), birth_date: z.nullable(z.lazy(() => BeneficiaryBirthDate$inboundSchema)) .optional(), email: z.string().optional(), entity_name: z.string().optional(), entity_type: BeneficiaryEntityType$inboundSchema.optional(), family_name: z.string().optional(), given_name: z.string().optional(), mailing_address: z.nullable(z.lazy(() => MailingAddress$inboundSchema)) .optional(), middle_names: z.string().optional(), phone_number: z.nullable(z.lazy(() => BeneficiaryPhoneNumber$inboundSchema)) .optional(), relation_type: BeneficiaryRelationType$inboundSchema.optional(), tax_id: z.string().optional(), tax_id_type: BeneficiaryTaxIdType$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "beneficiary_percentage": "beneficiaryPercentage", "birth_date": "birthDate", "entity_name": "entityName", "entity_type": "entityType", "family_name": "familyName", "given_name": "givenName", "mailing_address": "mailingAddress", "middle_names": "middleNames", "phone_number": "phoneNumber", "relation_type": "relationType", "tax_id": "taxId", "tax_id_type": "taxIdType", }); }); /** @internal */ export type Beneficiary$Outbound = { beneficiary_percentage?: number | undefined; birth_date?: BeneficiaryBirthDate$Outbound | null | undefined; email?: string | undefined; entity_name?: string | undefined; entity_type?: string | undefined; family_name?: string | undefined; given_name?: string | undefined; mailing_address?: MailingAddress$Outbound | null | undefined; middle_names?: string | undefined; phone_number?: BeneficiaryPhoneNumber$Outbound | null | undefined; relation_type?: string | undefined; tax_id?: string | undefined; tax_id_type?: string | undefined; }; /** @internal */ export const Beneficiary$outboundSchema: z.ZodType< Beneficiary$Outbound, z.ZodTypeDef, Beneficiary > = z.object({ beneficiaryPercentage: z.number().int().optional(), birthDate: z.nullable(z.lazy(() => BeneficiaryBirthDate$outboundSchema)) .optional(), email: z.string().optional(), entityName: z.string().optional(), entityType: BeneficiaryEntityType$outboundSchema.optional(), familyName: z.string().optional(), givenName: z.string().optional(), mailingAddress: z.nullable(z.lazy(() => MailingAddress$outboundSchema)) .optional(), middleNames: z.string().optional(), phoneNumber: z.nullable(z.lazy(() => BeneficiaryPhoneNumber$outboundSchema)) .optional(), relationType: BeneficiaryRelationType$outboundSchema.optional(), taxId: z.string().optional(), taxIdType: BeneficiaryTaxIdType$outboundSchema.optional(), }).transform((v) => { return remap$(v, { beneficiaryPercentage: "beneficiary_percentage", birthDate: "birth_date", entityName: "entity_name", entityType: "entity_type", familyName: "family_name", givenName: "given_name", mailingAddress: "mailing_address", middleNames: "middle_names", phoneNumber: "phone_number", relationType: "relation_type", taxId: "tax_id", taxIdType: "tax_id_type", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Beneficiary$ { /** @deprecated use `Beneficiary$inboundSchema` instead. */ export const inboundSchema = Beneficiary$inboundSchema; /** @deprecated use `Beneficiary$outboundSchema` instead. */ export const outboundSchema = Beneficiary$outboundSchema; /** @deprecated use `Beneficiary$Outbound` instead. */ export type Outbound = Beneficiary$Outbound; } export function beneficiaryToJSON(beneficiary: Beneficiary): string { return JSON.stringify(Beneficiary$outboundSchema.parse(beneficiary)); } export function beneficiaryFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Beneficiary$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Beneficiary' from JSON`, ); }