/* * 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 { safeParse } from "../../lib/schemas.js"; import * as openEnums from "../../types/enums.js"; import { OpenEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { RFCDate } from "../../types/rfcdate.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const AgeGroup = { Adult: "adult", Infant: "infant", } as const; export type AgeGroup = OpenEnum; export type AirlinePassenger = { /** * The age group for the passenger. */ ageGroup?: AgeGroup | null | undefined; /** * The passenger's date of birth in YYYY-MM-YY format. */ dateOfBirth?: RFCDate | null | undefined; /** * The email address of the passenger. */ emailAddress?: string | null | undefined; /** * The first name(s) or given name of the passenger. */ firstName?: string | null | undefined; /** * The passenger's frequent flyer number. */ frequentFlyerNumber?: string | null | undefined; /** * The last name, or family name, of the passenger. */ lastName?: string | null | undefined; /** * The passenger's unique passport number. */ passportNumber?: string | null | undefined; /** * The phone number of the passenger. This number is formatted according to the E164 number standard. */ phoneNumber?: string | null | undefined; /** * The ticket number for a flight. */ ticketNumber?: string | null | undefined; /** * Title of the passenger. */ title?: string | null | undefined; /** * The country of residence of the passenger */ countryCode?: string | null | undefined; }; /** @internal */ export const AgeGroup$inboundSchema: z.ZodType< AgeGroup, z.ZodTypeDef, unknown > = openEnums.inboundSchema(AgeGroup); /** @internal */ export const AgeGroup$outboundSchema: z.ZodType< string, z.ZodTypeDef, AgeGroup > = openEnums.outboundSchema(AgeGroup); /** @internal */ export const AirlinePassenger$inboundSchema: z.ZodType< AirlinePassenger, z.ZodTypeDef, unknown > = z.object({ age_group: z.nullable(AgeGroup$inboundSchema).optional(), date_of_birth: z.nullable(z.string().transform(v => new RFCDate(v))) .optional(), email_address: z.nullable(z.string()).optional(), first_name: z.nullable(z.string()).optional(), frequent_flyer_number: z.nullable(z.string()).optional(), last_name: z.nullable(z.string()).optional(), passport_number: z.nullable(z.string()).optional(), phone_number: z.nullable(z.string()).optional(), ticket_number: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), country_code: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "age_group": "ageGroup", "date_of_birth": "dateOfBirth", "email_address": "emailAddress", "first_name": "firstName", "frequent_flyer_number": "frequentFlyerNumber", "last_name": "lastName", "passport_number": "passportNumber", "phone_number": "phoneNumber", "ticket_number": "ticketNumber", "country_code": "countryCode", }); }); /** @internal */ export type AirlinePassenger$Outbound = { age_group?: string | null | undefined; date_of_birth?: string | null | undefined; email_address?: string | null | undefined; first_name?: string | null | undefined; frequent_flyer_number?: string | null | undefined; last_name?: string | null | undefined; passport_number?: string | null | undefined; phone_number?: string | null | undefined; ticket_number?: string | null | undefined; title?: string | null | undefined; country_code?: string | null | undefined; }; /** @internal */ export const AirlinePassenger$outboundSchema: z.ZodType< AirlinePassenger$Outbound, z.ZodTypeDef, AirlinePassenger > = z.object({ ageGroup: z.nullable(AgeGroup$outboundSchema).optional(), dateOfBirth: z.nullable(z.instanceof(RFCDate).transform(v => v.toString())) .optional(), emailAddress: z.nullable(z.string()).optional(), firstName: z.nullable(z.string()).optional(), frequentFlyerNumber: z.nullable(z.string()).optional(), lastName: z.nullable(z.string()).optional(), passportNumber: z.nullable(z.string()).optional(), phoneNumber: z.nullable(z.string()).optional(), ticketNumber: z.nullable(z.string()).optional(), title: z.nullable(z.string()).optional(), countryCode: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { ageGroup: "age_group", dateOfBirth: "date_of_birth", emailAddress: "email_address", firstName: "first_name", frequentFlyerNumber: "frequent_flyer_number", lastName: "last_name", passportNumber: "passport_number", phoneNumber: "phone_number", ticketNumber: "ticket_number", countryCode: "country_code", }); }); export function airlinePassengerToJSON( airlinePassenger: AirlinePassenger, ): string { return JSON.stringify( AirlinePassenger$outboundSchema.parse(airlinePassenger), ); } export function airlinePassengerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AirlinePassenger$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AirlinePassenger' from JSON`, ); }