/* * 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"; import { BusinessProfile, BusinessProfile$inboundSchema, BusinessProfile$Outbound, BusinessProfile$outboundSchema, } from "./businessprofile.js"; import { GuestProfile, GuestProfile$inboundSchema, GuestProfile$Outbound, GuestProfile$outboundSchema, } from "./guestprofile.js"; import { IndividualProfile, IndividualProfile$inboundSchema, IndividualProfile$Outbound, IndividualProfile$outboundSchema, } from "./individualprofile.js"; /** * Describes a Moov account profile. A profile will have a business, individual, or guest depending on the account's type. */ export type Profile = { /** * Describes an individual. */ individual?: IndividualProfile | undefined; /** * Describes a business. */ business?: BusinessProfile | undefined; /** * Describes a guest account profile. */ guest?: GuestProfile | undefined; }; /** @internal */ export const Profile$inboundSchema: z.ZodType = z.object({ individual: IndividualProfile$inboundSchema.optional(), business: BusinessProfile$inboundSchema.optional(), guest: GuestProfile$inboundSchema.optional(), }); /** @internal */ export type Profile$Outbound = { individual?: IndividualProfile$Outbound | undefined; business?: BusinessProfile$Outbound | undefined; guest?: GuestProfile$Outbound | undefined; }; /** @internal */ export const Profile$outboundSchema: z.ZodType< Profile$Outbound, z.ZodTypeDef, Profile > = z.object({ individual: IndividualProfile$outboundSchema.optional(), business: BusinessProfile$outboundSchema.optional(), guest: GuestProfile$outboundSchema.optional(), }); export function profileToJSON(profile: Profile): string { return JSON.stringify(Profile$outboundSchema.parse(profile)); } export function profileFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Profile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Profile' from JSON`, ); }