/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 023005f82be7
 */
import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import * as openEnums from "../../types/enums.js";
import { smartUnion } from "../../types/smartUnion.js";
import { MessageInputContentChunks$inboundSchema, MessageInputContentChunks$outboundSchema, } from "./messageinputcontentchunks.js";
export const Role = {
    Assistant: "assistant",
    User: "user",
};
/** @internal */
export const Role$inboundSchema = openEnums
    .inboundSchema(Role);
/** @internal */
export const Role$outboundSchema = openEnums
    .outboundSchema(Role);
/** @internal */
export const MessageInputEntryContent$inboundSchema = smartUnion([z.string(), z.array(MessageInputContentChunks$inboundSchema)]);
/** @internal */
export const MessageInputEntryContent$outboundSchema = smartUnion([z.string(), z.array(MessageInputContentChunks$outboundSchema)]);
export function messageInputEntryContentToJSON(messageInputEntryContent) {
    return JSON.stringify(MessageInputEntryContent$outboundSchema.parse(messageInputEntryContent));
}
export function messageInputEntryContentFromJSON(jsonString) {
    return safeParse(jsonString, (x) => MessageInputEntryContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MessageInputEntryContent' from JSON`);
}
/** @internal */
export const MessageInputEntry$inboundSchema = z.object({
    object: z.literal("entry").default("entry"),
    type: z.literal("message.input").default("message.input"),
    created_at: z.iso.datetime({ offset: true }).transform(v => new Date(v))
        .optional(),
    completed_at: z.nullable(z.iso.datetime({ offset: true }).transform(v => new Date(v))).optional(),
    id: z.string().optional(),
    role: Role$inboundSchema,
    content: smartUnion([
        z.string(),
        z.array(MessageInputContentChunks$inboundSchema),
    ]),
    prefix: z.boolean().default(false),
}).transform((v) => {
    return remap$(v, {
        "created_at": "createdAt",
        "completed_at": "completedAt",
    });
});
/** @internal */
export const MessageInputEntry$outboundSchema = z.object({
    object: z.literal("entry").default("entry"),
    type: z.literal("message.input").default("message.input"),
    createdAt: z.date().transform(v => v.toISOString()).optional(),
    completedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    id: z.string().optional(),
    role: Role$outboundSchema,
    content: smartUnion([
        z.string(),
        z.array(MessageInputContentChunks$outboundSchema),
    ]),
    prefix: z.boolean().default(false),
}).transform((v) => {
    return remap$(v, {
        createdAt: "created_at",
        completedAt: "completed_at",
    });
});
export function messageInputEntryToJSON(messageInputEntry) {
    return JSON.stringify(MessageInputEntry$outboundSchema.parse(messageInputEntry));
}
export function messageInputEntryFromJSON(jsonString) {
    return safeParse(jsonString, (x) => MessageInputEntry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MessageInputEntry' from JSON`);
}
//# sourceMappingURL=messageinputentry.js.map