/* * 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 BirthDate = { day: number; month: number; year: number; }; /** @internal */ export const BirthDate$inboundSchema: z.ZodType< BirthDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int(), month: z.number().int(), year: z.number().int(), }); /** @internal */ export type BirthDate$Outbound = { day: number; month: number; year: number; }; /** @internal */ export const BirthDate$outboundSchema: z.ZodType< BirthDate$Outbound, z.ZodTypeDef, BirthDate > = z.object({ day: z.number().int(), month: z.number().int(), year: z.number().int(), }); export function birthDateToJSON(birthDate: BirthDate): string { return JSON.stringify(BirthDate$outboundSchema.parse(birthDate)); } export function birthDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BirthDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BirthDate' from JSON`, ); }