/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: bec82e897296
 */
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { smartUnion } from "../../types/smartUnion.js";
import { ContentChunk$inboundSchema, ContentChunk$outboundSchema, } from "./contentchunk.js";
import { ToolCall$inboundSchema, ToolCall$outboundSchema, } from "./toolcall.js";
/** @internal */
export const AssistantMessageContent$inboundSchema = smartUnion([z.string(), z.array(ContentChunk$inboundSchema)]);
/** @internal */
export const AssistantMessageContent$outboundSchema = smartUnion([z.string(), z.array(ContentChunk$outboundSchema)]);
export function assistantMessageContentToJSON(assistantMessageContent) {
    return JSON.stringify(AssistantMessageContent$outboundSchema.parse(assistantMessageContent));
}
export function assistantMessageContentFromJSON(jsonString) {
    return safeParse(jsonString, (x) => AssistantMessageContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AssistantMessageContent' from JSON`);
}
/** @internal */
export const AssistantMessage$inboundSchema = z.object({
    role: z.literal("assistant").default("assistant"),
    content: z.nullable(smartUnion([z.string(), z.array(ContentChunk$inboundSchema)])).optional(),
    tool_calls: z.nullable(z.array(ToolCall$inboundSchema)).optional(),
    prefix: z.boolean().default(false),
}).transform((v) => {
    return remap$(v, {
        "tool_calls": "toolCalls",
    });
});
/** @internal */
export const AssistantMessage$outboundSchema = z.object({
    role: z.literal("assistant").default("assistant"),
    content: z.nullable(smartUnion([z.string(), z.array(ContentChunk$outboundSchema)])).optional(),
    toolCalls: z.nullable(z.array(ToolCall$outboundSchema)).optional(),
    prefix: z.boolean().default(false),
}).transform((v) => {
    return remap$(v, {
        toolCalls: "tool_calls",
    });
});
export function assistantMessageToJSON(assistantMessage) {
    return JSON.stringify(AssistantMessage$outboundSchema.parse(assistantMessage));
}
export function assistantMessageFromJSON(jsonString) {
    return safeParse(jsonString, (x) => AssistantMessage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AssistantMessage' from JSON`);
}
//# sourceMappingURL=assistantmessage.js.map