/* * 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 identification type for a person, one of: * * @remarks * - `ID_TYPE_UNSPECIFIED` - Default/Null value. * - `SSN` - SSN tax type. * - `ITIN` - ITIN tax type. * - `FTIN` - FTIN (foreign tax id) type. * - `NATIONAL_ID` - National id type. * - `PASSPORT` - Passport id type. * - `DRIVING_LICENSE` - Drivers license id type. * - `STATE_ID_CARD` - State ID card. * - `NATIONAL_ID_CARD` - National ID card. * - `PERMANENT_RESIDENT_VISA` - Permanent resident visa. * - `MILITARY_ID_CARD` - Military ID card. */ export enum PersonIdentificationType { IdTypeUnspecified = "ID_TYPE_UNSPECIFIED", Ssn = "SSN", Itin = "ITIN", Ftin = "FTIN", NationalId = "NATIONAL_ID", Passport = "PASSPORT", DrivingLicense = "DRIVING_LICENSE", StateIdCard = "STATE_ID_CARD", NationalIdCard = "NATIONAL_ID_CARD", PermanentResidentVisa = "PERMANENT_RESIDENT_VISA", MilitaryIdCard = "MILITARY_ID_CARD", } /** * The identification type for a person, one of: * * @remarks * - `ID_TYPE_UNSPECIFIED` - Default/Null value. * - `SSN` - SSN tax type. * - `ITIN` - ITIN tax type. * - `FTIN` - FTIN (foreign tax id) type. * - `NATIONAL_ID` - National id type. * - `PASSPORT` - Passport id type. * - `DRIVING_LICENSE` - Drivers license id type. * - `STATE_ID_CARD` - State ID card. * - `NATIONAL_ID_CARD` - National ID card. * - `PERMANENT_RESIDENT_VISA` - Permanent resident visa. * - `MILITARY_ID_CARD` - Military ID card. */ export type PersonIdentificationTypeOpen = OpenEnum< typeof PersonIdentificationType >; /** * stores various identification types */ export type PersonIdentification = { /** * Administrative area that issued the identification For example, this can be a state, a province, an oblast, or a prefecture. */ administrativeArea?: string | undefined; /** * One or more UUIDs from the documents api of the image(s) of the document that relates to the identification for the person investigation. */ documentReferenceIds?: Array | undefined; /** * Country that issued identification Two character region code, complies with https://cldr.unicode.org/index */ regionCode?: string | undefined; /** * The identification type for a person, one of: * * @remarks * - `ID_TYPE_UNSPECIFIED` - Default/Null value. * - `SSN` - SSN tax type. * - `ITIN` - ITIN tax type. * - `FTIN` - FTIN (foreign tax id) type. * - `NATIONAL_ID` - National id type. * - `PASSPORT` - Passport id type. * - `DRIVING_LICENSE` - Drivers license id type. * - `STATE_ID_CARD` - State ID card. * - `NATIONAL_ID_CARD` - National ID card. * - `PERMANENT_RESIDENT_VISA` - Permanent resident visa. * - `MILITARY_ID_CARD` - Military ID card. */ type?: PersonIdentificationTypeOpen | undefined; /** * Tax id value */ value?: string | undefined; }; /** @internal */ export const PersonIdentificationType$inboundSchema: z.ZodType< PersonIdentificationTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(PersonIdentificationType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const PersonIdentificationType$outboundSchema: z.ZodType< PersonIdentificationTypeOpen, z.ZodTypeDef, PersonIdentificationTypeOpen > = z.union([ z.nativeEnum(PersonIdentificationType), 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 PersonIdentificationType$ { /** @deprecated use `PersonIdentificationType$inboundSchema` instead. */ export const inboundSchema = PersonIdentificationType$inboundSchema; /** @deprecated use `PersonIdentificationType$outboundSchema` instead. */ export const outboundSchema = PersonIdentificationType$outboundSchema; } /** @internal */ export const PersonIdentification$inboundSchema: z.ZodType< PersonIdentification, z.ZodTypeDef, unknown > = z.object({ administrative_area: z.string().optional(), document_reference_ids: z.array(z.string()).optional(), region_code: z.string().optional(), type: PersonIdentificationType$inboundSchema.optional(), value: z.string().optional(), }).transform((v) => { return remap$(v, { "administrative_area": "administrativeArea", "document_reference_ids": "documentReferenceIds", "region_code": "regionCode", }); }); /** @internal */ export type PersonIdentification$Outbound = { administrative_area?: string | undefined; document_reference_ids?: Array | undefined; region_code?: string | undefined; type?: string | undefined; value?: string | undefined; }; /** @internal */ export const PersonIdentification$outboundSchema: z.ZodType< PersonIdentification$Outbound, z.ZodTypeDef, PersonIdentification > = z.object({ administrativeArea: z.string().optional(), documentReferenceIds: z.array(z.string()).optional(), regionCode: z.string().optional(), type: PersonIdentificationType$outboundSchema.optional(), value: z.string().optional(), }).transform((v) => { return remap$(v, { administrativeArea: "administrative_area", documentReferenceIds: "document_reference_ids", 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 PersonIdentification$ { /** @deprecated use `PersonIdentification$inboundSchema` instead. */ export const inboundSchema = PersonIdentification$inboundSchema; /** @deprecated use `PersonIdentification$outboundSchema` instead. */ export const outboundSchema = PersonIdentification$outboundSchema; /** @deprecated use `PersonIdentification$Outbound` instead. */ export type Outbound = PersonIdentification$Outbound; } export function personIdentificationToJSON( personIdentification: PersonIdentification, ): string { return JSON.stringify( PersonIdentification$outboundSchema.parse(personIdentification), ); } export function personIdentificationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PersonIdentification$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PersonIdentification' from JSON`, ); }