/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 4b4abd9fb606
 */
import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { discriminatedUnion } from "../../types/discriminatedUnion.js";
import { AudioChunk$inboundSchema, AudioChunk$outboundSchema, } from "./audiochunk.js";
import { DocumentURLChunk$inboundSchema, DocumentURLChunk$outboundSchema, } from "./documenturlchunk.js";
import { FileChunk$inboundSchema, FileChunk$outboundSchema, } from "./filechunk.js";
import { ImageURLChunk$inboundSchema, ImageURLChunk$outboundSchema, } from "./imageurlchunk.js";
import { ReferenceChunk$inboundSchema, ReferenceChunk$outboundSchema, } from "./referencechunk.js";
import { TextChunk$inboundSchema, TextChunk$outboundSchema, } from "./textchunk.js";
import { ThinkChunk$inboundSchema, ThinkChunk$outboundSchema, } from "./thinkchunk.js";
/** @internal */
export const ContentChunk$inboundSchema = discriminatedUnion("type", {
    image_url: ImageURLChunk$inboundSchema.and(z.object({ type: z.literal("image_url") })),
    document_url: DocumentURLChunk$inboundSchema.and(z.object({ type: z.literal("document_url") })),
    text: TextChunk$inboundSchema.and(z.object({ type: z.literal("text") })),
    reference: ReferenceChunk$inboundSchema.and(z.object({ type: z.literal("reference") })),
    file: FileChunk$inboundSchema.and(z.object({ type: z.literal("file") })),
    thinking: ThinkChunk$inboundSchema.and(z.object({ type: z.literal("thinking") })),
    input_audio: AudioChunk$inboundSchema,
});
/** @internal */
export const ContentChunk$outboundSchema = z.union([
    ImageURLChunk$outboundSchema.and(z.object({ type: z.literal("image_url") })),
    DocumentURLChunk$outboundSchema.and(z.object({ type: z.literal("document_url") })),
    TextChunk$outboundSchema.and(z.object({ type: z.literal("text") })),
    ReferenceChunk$outboundSchema.and(z.object({ type: z.literal("reference") })),
    FileChunk$outboundSchema.and(z.object({ type: z.literal("file") })),
    ThinkChunk$outboundSchema.and(z.object({ type: z.literal("thinking") })),
    AudioChunk$outboundSchema,
]);
export function contentChunkToJSON(contentChunk) {
    return JSON.stringify(ContentChunk$outboundSchema.parse(contentChunk));
}
export function contentChunkFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ContentChunk$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContentChunk' from JSON`);
}
//# sourceMappingURL=contentchunk.js.map