/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { RFCDate } from "../../types/rfcdate.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Gender, Gender$inboundSchema, Gender$outboundSchema, } from "./gender.js"; export type PersonInput = { /** * The first name of the person. */ firstName?: string | null | undefined; /** * The last name of the person. */ lastName?: string | null | undefined; /** * Middle name of the person. */ middleName?: string | null | undefined; /** * The gender represents the gender identity of a person. */ gender?: Gender | null | undefined; /** * Initials of the person */ initials?: string | null | undefined; /** * Date of birth */ birthday?: RFCDate | null | undefined; /** * Date of death */ deceasedOn?: RFCDate | null | undefined; }; /** @internal */ export const PersonInput$inboundSchema: z.ZodType< PersonInput, z.ZodTypeDef, unknown > = z.object({ first_name: z.nullable(z.string()).optional(), last_name: z.nullable(z.string()).optional(), middle_name: z.nullable(z.string()).optional(), gender: z.nullable(Gender$inboundSchema).optional(), initials: z.nullable(z.string()).optional(), birthday: z.nullable(z.string().transform(v => new RFCDate(v))).optional(), deceased_on: z.nullable(z.string().transform(v => new RFCDate(v))).optional(), }).transform((v) => { return remap$(v, { "first_name": "firstName", "last_name": "lastName", "middle_name": "middleName", "deceased_on": "deceasedOn", }); }); /** @internal */ export type PersonInput$Outbound = { first_name?: string | null | undefined; last_name?: string | null | undefined; middle_name?: string | null | undefined; gender?: string | null | undefined; initials?: string | null | undefined; birthday?: string | null | undefined; deceased_on?: string | null | undefined; }; /** @internal */ export const PersonInput$outboundSchema: z.ZodType< PersonInput$Outbound, z.ZodTypeDef, PersonInput > = z.object({ firstName: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), middleName: z.nullable(z.string()).optional(), gender: z.nullable(Gender$outboundSchema).optional(), initials: z.nullable(z.string()).optional(), birthday: z.nullable(z.instanceof(RFCDate).transform(v => v.toString())) .optional(), deceasedOn: z.nullable(z.instanceof(RFCDate).transform(v => v.toString())) .optional(), }).transform((v) => { return remap$(v, { firstName: "first_name", lastName: "last_name", middleName: "middle_name", deceasedOn: "deceased_on", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PersonInput$ { /** @deprecated use `PersonInput$inboundSchema` instead. */ export const inboundSchema = PersonInput$inboundSchema; /** @deprecated use `PersonInput$outboundSchema` instead. */ export const outboundSchema = PersonInput$outboundSchema; /** @deprecated use `PersonInput$Outbound` instead. */ export type Outbound = PersonInput$Outbound; } export function personInputToJSON(personInput: PersonInput): string { return JSON.stringify(PersonInput$outboundSchema.parse(personInput)); } export function personInputFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PersonInput$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PersonInput' from JSON`, ); }