/* * 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"; /** * Identification type */ export enum ForeignIdentificationUpdateType { IdentificationTypeUnspecified = "IDENTIFICATION_TYPE_UNSPECIFIED", Passport = "PASSPORT", NationalId = "NATIONAL_ID", DriversLicense = "DRIVERS_LICENSE", } /** * Identification type */ export type ForeignIdentificationUpdateTypeOpen = OpenEnum< typeof ForeignIdentificationUpdateType >; /** * Foreign identification */ export type ForeignIdentificationUpdate = { /** * 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`. */ expirationDate?: DateUpdate | undefined; /** * Denotes if the identification is a tax id or other */ ftin?: boolean | undefined; /** * Identification number */ identificationNumber?: 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`. */ issueDate?: DateUpdate | undefined; /** * Region of issuance must be provided as a two-character CLDR country code */ issuingRegionCode?: string | undefined; /** * Identification type */ type?: ForeignIdentificationUpdateTypeOpen | undefined; }; /** @internal */ export const ForeignIdentificationUpdateType$inboundSchema: z.ZodType< ForeignIdentificationUpdateTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(ForeignIdentificationUpdateType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const ForeignIdentificationUpdateType$outboundSchema: z.ZodType< ForeignIdentificationUpdateTypeOpen, z.ZodTypeDef, ForeignIdentificationUpdateTypeOpen > = z.union([ z.nativeEnum(ForeignIdentificationUpdateType), 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 ForeignIdentificationUpdateType$ { /** @deprecated use `ForeignIdentificationUpdateType$inboundSchema` instead. */ export const inboundSchema = ForeignIdentificationUpdateType$inboundSchema; /** @deprecated use `ForeignIdentificationUpdateType$outboundSchema` instead. */ export const outboundSchema = ForeignIdentificationUpdateType$outboundSchema; } /** @internal */ export const ForeignIdentificationUpdate$inboundSchema: z.ZodType< ForeignIdentificationUpdate, z.ZodTypeDef, unknown > = z.object({ expiration_date: DateUpdate$inboundSchema.optional(), ftin: z.boolean().optional(), identification_number: z.string().optional(), issue_date: DateUpdate$inboundSchema.optional(), issuing_region_code: z.string().optional(), type: ForeignIdentificationUpdateType$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "expiration_date": "expirationDate", "identification_number": "identificationNumber", "issue_date": "issueDate", "issuing_region_code": "issuingRegionCode", }); }); /** @internal */ export type ForeignIdentificationUpdate$Outbound = { expiration_date?: DateUpdate$Outbound | undefined; ftin?: boolean | undefined; identification_number?: string | undefined; issue_date?: DateUpdate$Outbound | undefined; issuing_region_code?: string | undefined; type?: string | undefined; }; /** @internal */ export const ForeignIdentificationUpdate$outboundSchema: z.ZodType< ForeignIdentificationUpdate$Outbound, z.ZodTypeDef, ForeignIdentificationUpdate > = z.object({ expirationDate: DateUpdate$outboundSchema.optional(), ftin: z.boolean().optional(), identificationNumber: z.string().optional(), issueDate: DateUpdate$outboundSchema.optional(), issuingRegionCode: z.string().optional(), type: ForeignIdentificationUpdateType$outboundSchema.optional(), }).transform((v) => { return remap$(v, { expirationDate: "expiration_date", identificationNumber: "identification_number", issueDate: "issue_date", issuingRegionCode: "issuing_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 ForeignIdentificationUpdate$ { /** @deprecated use `ForeignIdentificationUpdate$inboundSchema` instead. */ export const inboundSchema = ForeignIdentificationUpdate$inboundSchema; /** @deprecated use `ForeignIdentificationUpdate$outboundSchema` instead. */ export const outboundSchema = ForeignIdentificationUpdate$outboundSchema; /** @deprecated use `ForeignIdentificationUpdate$Outbound` instead. */ export type Outbound = ForeignIdentificationUpdate$Outbound; } export function foreignIdentificationUpdateToJSON( foreignIdentificationUpdate: ForeignIdentificationUpdate, ): string { return JSON.stringify( ForeignIdentificationUpdate$outboundSchema.parse( foreignIdentificationUpdate, ), ); } export function foreignIdentificationUpdateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ForeignIdentificationUpdate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ForeignIdentificationUpdate' from JSON`, ); }