/* * 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 type of identification document */ export enum IdentificationCreateType { TypeUnspecified = "TYPE_UNSPECIFIED", Ssn = "SSN", Cpf = "CPF", } /** * The type of identification document */ export type IdentificationCreateTypeOpen = OpenEnum< typeof IdentificationCreateType >; /** * Represents an identification document */ export type IdentificationCreate = { /** * CLDR format */ regionCode: string; /** * The type of identification document */ type: IdentificationCreateTypeOpen; /** * The value of the identification document */ value: string; }; /** @internal */ export const IdentificationCreateType$inboundSchema: z.ZodType< IdentificationCreateTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(IdentificationCreateType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const IdentificationCreateType$outboundSchema: z.ZodType< IdentificationCreateTypeOpen, z.ZodTypeDef, IdentificationCreateTypeOpen > = z.union([ z.nativeEnum(IdentificationCreateType), 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 IdentificationCreateType$ { /** @deprecated use `IdentificationCreateType$inboundSchema` instead. */ export const inboundSchema = IdentificationCreateType$inboundSchema; /** @deprecated use `IdentificationCreateType$outboundSchema` instead. */ export const outboundSchema = IdentificationCreateType$outboundSchema; } /** @internal */ export const IdentificationCreate$inboundSchema: z.ZodType< IdentificationCreate, z.ZodTypeDef, unknown > = z.object({ region_code: z.string(), type: IdentificationCreateType$inboundSchema, value: z.string(), }).transform((v) => { return remap$(v, { "region_code": "regionCode", }); }); /** @internal */ export type IdentificationCreate$Outbound = { region_code: string; type: string; value: string; }; /** @internal */ export const IdentificationCreate$outboundSchema: z.ZodType< IdentificationCreate$Outbound, z.ZodTypeDef, IdentificationCreate > = z.object({ regionCode: z.string(), type: IdentificationCreateType$outboundSchema, value: z.string(), }).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 IdentificationCreate$ { /** @deprecated use `IdentificationCreate$inboundSchema` instead. */ export const inboundSchema = IdentificationCreate$inboundSchema; /** @deprecated use `IdentificationCreate$outboundSchema` instead. */ export const outboundSchema = IdentificationCreate$outboundSchema; /** @deprecated use `IdentificationCreate$Outbound` instead. */ export type Outbound = IdentificationCreate$Outbound; } export function identificationCreateToJSON( identificationCreate: IdentificationCreate, ): string { return JSON.stringify( IdentificationCreate$outboundSchema.parse(identificationCreate), ); } export function identificationCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => IdentificationCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'IdentificationCreate' from JSON`, ); }