/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { lazySchema as lazySchema$, safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as types from "../../types/primitives.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Gender, Gender$inboundSchema } from "./gender.js"; export type Person = { /** * A unique identifier for an object. */ id?: string | null | undefined; /** * 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?: Date | null | undefined; /** * Date of death */ deceasedOn?: Date | null | undefined; /** * When custom mappings are configured on the resource, the result is included here. */ customMappings?: { [k: string]: any } | null | undefined; }; /** @internal */ export const Person$inboundSchema: z.ZodType = /* @__PURE__ */ lazySchema$(() => z.object({ id: z.nullable(types.string()).optional(), first_name: z.nullable(types.string()).optional(), last_name: z.nullable(types.string()).optional(), middle_name: z.nullable(types.string()).optional(), gender: z.nullable(Gender$inboundSchema).optional(), initials: z.nullable(types.string()).optional(), birthday: z.nullable(types.date()).optional(), deceased_on: z.nullable(types.date()).optional(), custom_mappings: z.nullable(z.record(z.any())).optional(), }).transform((v) => { return remap$(v, { "first_name": "firstName", "last_name": "lastName", "middle_name": "middleName", "deceased_on": "deceasedOn", "custom_mappings": "customMappings", }); }) ); export function personFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Person$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Person' from JSON`, ); }