/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { OpenAIExtendedMessage$inboundSchema, OpenAIExtendedMessage$outboundSchema, } from "./openaiextendedmessage.js";
import { SupportCopilotMessage$inboundSchema, SupportCopilotMessage$outboundSchema, } from "./supportcopilotmessage.js";
import { SupportTicketMessage$inboundSchema, SupportTicketMessage$outboundSchema, } from "./supportticketmessage.js";
/** @internal */
export const Message$inboundSchema = z.union([
    OpenAIExtendedMessage$inboundSchema.and(z.object({ type: z.literal("openai") })),
    SupportTicketMessage$inboundSchema.and(z.object({ type: z.literal("support_ticket") })),
    SupportCopilotMessage$inboundSchema.and(z.object({ type: z.literal("support_copilot") })),
]);
/** @internal */
export const Message$outboundSchema = z.union([
    OpenAIExtendedMessage$outboundSchema.and(z.object({ type: z.literal("openai") })),
    SupportTicketMessage$outboundSchema.and(z.object({ type: z.literal("support_ticket") })),
    SupportCopilotMessage$outboundSchema.and(z.object({ type: z.literal("support_copilot") })),
]);
export function messageToJSON(message) {
    return JSON.stringify(Message$outboundSchema.parse(message));
}
export function messageFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Message$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Message' from JSON`);
}
//# sourceMappingURL=message.js.map