/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GovernmentIDErrorSsn = { full?: string | undefined; lastFour?: string | undefined; }; export type GovernmentIDErrorItin = { full?: string | undefined; lastFour?: string | undefined; }; export type GovernmentIDError = { ssn?: GovernmentIDErrorSsn | undefined; itin?: GovernmentIDErrorItin | undefined; }; /** @internal */ export const GovernmentIDErrorSsn$inboundSchema: z.ZodType< GovernmentIDErrorSsn, z.ZodTypeDef, unknown > = z.object({ full: z.string().optional(), lastFour: z.string().optional(), }); /** @internal */ export type GovernmentIDErrorSsn$Outbound = { full?: string | undefined; lastFour?: string | undefined; }; /** @internal */ export const GovernmentIDErrorSsn$outboundSchema: z.ZodType< GovernmentIDErrorSsn$Outbound, z.ZodTypeDef, GovernmentIDErrorSsn > = z.object({ full: z.string().optional(), lastFour: z.string().optional(), }); export function governmentIDErrorSsnToJSON( governmentIDErrorSsn: GovernmentIDErrorSsn, ): string { return JSON.stringify( GovernmentIDErrorSsn$outboundSchema.parse(governmentIDErrorSsn), ); } export function governmentIDErrorSsnFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GovernmentIDErrorSsn$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GovernmentIDErrorSsn' from JSON`, ); } /** @internal */ export const GovernmentIDErrorItin$inboundSchema: z.ZodType< GovernmentIDErrorItin, z.ZodTypeDef, unknown > = z.object({ full: z.string().optional(), lastFour: z.string().optional(), }); /** @internal */ export type GovernmentIDErrorItin$Outbound = { full?: string | undefined; lastFour?: string | undefined; }; /** @internal */ export const GovernmentIDErrorItin$outboundSchema: z.ZodType< GovernmentIDErrorItin$Outbound, z.ZodTypeDef, GovernmentIDErrorItin > = z.object({ full: z.string().optional(), lastFour: z.string().optional(), }); export function governmentIDErrorItinToJSON( governmentIDErrorItin: GovernmentIDErrorItin, ): string { return JSON.stringify( GovernmentIDErrorItin$outboundSchema.parse(governmentIDErrorItin), ); } export function governmentIDErrorItinFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GovernmentIDErrorItin$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GovernmentIDErrorItin' from JSON`, ); } /** @internal */ export const GovernmentIDError$inboundSchema: z.ZodType< GovernmentIDError, z.ZodTypeDef, unknown > = z.object({ ssn: z.lazy(() => GovernmentIDErrorSsn$inboundSchema).optional(), itin: z.lazy(() => GovernmentIDErrorItin$inboundSchema).optional(), }); /** @internal */ export type GovernmentIDError$Outbound = { ssn?: GovernmentIDErrorSsn$Outbound | undefined; itin?: GovernmentIDErrorItin$Outbound | undefined; }; /** @internal */ export const GovernmentIDError$outboundSchema: z.ZodType< GovernmentIDError$Outbound, z.ZodTypeDef, GovernmentIDError > = z.object({ ssn: z.lazy(() => GovernmentIDErrorSsn$outboundSchema).optional(), itin: z.lazy(() => GovernmentIDErrorItin$outboundSchema).optional(), }); export function governmentIDErrorToJSON( governmentIDError: GovernmentIDError, ): string { return JSON.stringify( GovernmentIDError$outboundSchema.parse(governmentIDError), ); } export function governmentIDErrorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GovernmentIDError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GovernmentIDError' from JSON`, ); }