/*
 * 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 { OpenAIContentItem$inboundSchema, OpenAIContentItem$outboundSchema, } from "./openaicontentitem.js";
import { OpenAIToolCall$inboundSchema, OpenAIToolCall$outboundSchema, } from "./openaitoolcall.js";
export const OpenAIChatCompletionMessageRole = {
    System: "system",
    User: "user",
    Assistant: "assistant",
};
/** @internal */
export const OpenAIChatCompletionMessageRole$inboundSchema = z.nativeEnum(OpenAIChatCompletionMessageRole);
/** @internal */
export const OpenAIChatCompletionMessageRole$outboundSchema = OpenAIChatCompletionMessageRole$inboundSchema;
/** @internal */
export const OpenAIChatCompletionMessageContent$inboundSchema = z.union([z.string(), z.array(OpenAIContentItem$inboundSchema)]);
/** @internal */
export const OpenAIChatCompletionMessageContent$outboundSchema = z.union([z.string(), z.array(OpenAIContentItem$outboundSchema)]);
export function openAIChatCompletionMessageContentToJSON(openAIChatCompletionMessageContent) {
    return JSON.stringify(OpenAIChatCompletionMessageContent$outboundSchema.parse(openAIChatCompletionMessageContent));
}
export function openAIChatCompletionMessageContentFromJSON(jsonString) {
    return safeParse(jsonString, (x) => OpenAIChatCompletionMessageContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIChatCompletionMessageContent' from JSON`);
}
/** @internal */
export const OpenAIChatCompletionMessage$inboundSchema = z.object({
    role: OpenAIChatCompletionMessageRole$inboundSchema,
    name: z.nullable(z.string()).optional(),
    content: z.union([z.string(), z.array(OpenAIContentItem$inboundSchema)]),
    tool_calls: z.nullable(z.array(OpenAIToolCall$inboundSchema)).optional(),
}).transform((v) => {
    return remap$(v, {
        "tool_calls": "toolCalls",
    });
});
/** @internal */
export const OpenAIChatCompletionMessage$outboundSchema = z.object({
    role: OpenAIChatCompletionMessageRole$outboundSchema,
    name: z.nullable(z.string()).optional(),
    content: z.union([z.string(), z.array(OpenAIContentItem$outboundSchema)]),
    toolCalls: z.nullable(z.array(OpenAIToolCall$outboundSchema)).optional(),
}).transform((v) => {
    return remap$(v, {
        toolCalls: "tool_calls",
    });
});
export function openAIChatCompletionMessageToJSON(openAIChatCompletionMessage) {
    return JSON.stringify(OpenAIChatCompletionMessage$outboundSchema.parse(openAIChatCompletionMessage));
}
export function openAIChatCompletionMessageFromJSON(jsonString) {
    return safeParse(jsonString, (x) => OpenAIChatCompletionMessage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIChatCompletionMessage' from JSON`);
}
//# sourceMappingURL=openaichatcompletionmessage.js.map