/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomerIndividual, CustomerIndividual$inboundSchema, CustomerIndividual$Outbound, CustomerIndividual$outboundSchema, } from "./customerindividual.js"; import { CustomerTeam, CustomerTeam$inboundSchema, CustomerTeam$Outbound, CustomerTeam$outboundSchema, } from "./customerteam.js"; export type Customer = CustomerIndividual | CustomerTeam; /** @internal */ export const Customer$inboundSchema: z.ZodMiniType = z.union( [CustomerIndividual$inboundSchema, CustomerTeam$inboundSchema], ); /** @internal */ export type Customer$Outbound = | CustomerIndividual$Outbound | CustomerTeam$Outbound; /** @internal */ export const Customer$outboundSchema: z.ZodMiniType< Customer$Outbound, Customer > = z.union([CustomerIndividual$outboundSchema, CustomerTeam$outboundSchema]); export function customerToJSON(customer: Customer): string { return JSON.stringify(Customer$outboundSchema.parse(customer)); } export function customerFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Customer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Customer' from JSON`, ); }