/* * 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"; /** * **Field Dependencies:** * * @remarks * * An SSN or ITIN is required when `check_types` is `DATABASE` * * Required if `check_types` is `DATABASE`. * * Otherwise, must be empty. */ export enum IdentityIdentificationType { TypeUnspecified = "TYPE_UNSPECIFIED", Ssn = "SSN", Passport = "PASSPORT", DriversLicense = "DRIVERS_LICENSE", Itin = "ITIN", IdCard = "ID_CARD", } /** * **Field Dependencies:** * * @remarks * * An SSN or ITIN is required when `check_types` is `DATABASE` * * Required if `check_types` is `DATABASE`. * * Otherwise, must be empty. */ export type IdentityIdentificationTypeOpen = OpenEnum< typeof IdentityIdentificationType >; /** * stores various identification types */ export type IdentityIdentification = { /** * Administrative area that issued the identification */ administrativeArea?: string | undefined; /** * **Field Dependencies:** * * @remarks * * A US identification `region_code` is required when the `check_types` is `DATABASE` * * Required if `check_types` is `DATABASE`. * * Otherwise, must be empty. */ regionCode?: string | undefined; /** * **Field Dependencies:** * * @remarks * * An SSN or ITIN is required when `check_types` is `DATABASE` * * Required if `check_types` is `DATABASE`. * * Otherwise, must be empty. */ type?: IdentityIdentificationTypeOpen | undefined; /** * **Field Dependencies:** * * @remarks * * An identification value is required when the `check_types` is `DATABASE` * * Required if `check_types` is `DATABASE`. * * Otherwise, must be empty. */ value?: string | undefined; }; /** @internal */ export const IdentityIdentificationType$inboundSchema: z.ZodType< IdentityIdentificationTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(IdentityIdentificationType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const IdentityIdentificationType$outboundSchema: z.ZodType< IdentityIdentificationTypeOpen, z.ZodTypeDef, IdentityIdentificationTypeOpen > = z.union([ z.nativeEnum(IdentityIdentificationType), 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 IdentityIdentificationType$ { /** @deprecated use `IdentityIdentificationType$inboundSchema` instead. */ export const inboundSchema = IdentityIdentificationType$inboundSchema; /** @deprecated use `IdentityIdentificationType$outboundSchema` instead. */ export const outboundSchema = IdentityIdentificationType$outboundSchema; } /** @internal */ export const IdentityIdentification$inboundSchema: z.ZodType< IdentityIdentification, z.ZodTypeDef, unknown > = z.object({ administrative_area: z.string().optional(), region_code: z.string().optional(), type: IdentityIdentificationType$inboundSchema.optional(), value: z.string().optional(), }).transform((v) => { return remap$(v, { "administrative_area": "administrativeArea", "region_code": "regionCode", }); }); /** @internal */ export type IdentityIdentification$Outbound = { administrative_area?: string | undefined; region_code?: string | undefined; type?: string | undefined; value?: string | undefined; }; /** @internal */ export const IdentityIdentification$outboundSchema: z.ZodType< IdentityIdentification$Outbound, z.ZodTypeDef, IdentityIdentification > = z.object({ administrativeArea: z.string().optional(), regionCode: z.string().optional(), type: IdentityIdentificationType$outboundSchema.optional(), value: z.string().optional(), }).transform((v) => { return remap$(v, { administrativeArea: "administrative_area", 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 IdentityIdentification$ { /** @deprecated use `IdentityIdentification$inboundSchema` instead. */ export const inboundSchema = IdentityIdentification$inboundSchema; /** @deprecated use `IdentityIdentification$outboundSchema` instead. */ export const outboundSchema = IdentityIdentification$outboundSchema; /** @deprecated use `IdentityIdentification$Outbound` instead. */ export type Outbound = IdentityIdentification$Outbound; } export function identityIdentificationToJSON( identityIdentification: IdentityIdentification, ): string { return JSON.stringify( IdentityIdentification$outboundSchema.parse(identityIdentification), ); } export function identityIdentificationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IdentityIdentification$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IdentityIdentification' from JSON`, ); }