/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 18d2ae0c1a0c
 */
import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { smartUnion } from "../../types/smartUnion.js";
import { ReferenceChunk$inboundSchema, ReferenceChunk$outboundSchema, } from "./referencechunk.js";
import { TextChunk$inboundSchema, TextChunk$outboundSchema, } from "./textchunk.js";
import { ToolReferenceChunk$inboundSchema, ToolReferenceChunk$outboundSchema, } from "./toolreferencechunk.js";
/** @internal */
export const Thinking$inboundSchema = smartUnion([
    ToolReferenceChunk$inboundSchema,
    TextChunk$inboundSchema,
    ReferenceChunk$inboundSchema,
]);
/** @internal */
export const Thinking$outboundSchema = smartUnion([
    ToolReferenceChunk$outboundSchema,
    TextChunk$outboundSchema,
    ReferenceChunk$outboundSchema,
]);
export function thinkingToJSON(thinking) {
    return JSON.stringify(Thinking$outboundSchema.parse(thinking));
}
export function thinkingFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Thinking$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Thinking' from JSON`);
}
/** @internal */
export const ThinkChunk$inboundSchema = z
    .object({
    type: z.literal("thinking").default("thinking"),
    thinking: z.array(smartUnion([
        ToolReferenceChunk$inboundSchema,
        TextChunk$inboundSchema,
        ReferenceChunk$inboundSchema,
    ])),
    signature: z.nullable(z.string()).optional(),
    closed: z.boolean().optional(),
});
/** @internal */
export const ThinkChunk$outboundSchema = z.object({
    type: z.literal("thinking").default("thinking"),
    thinking: z.array(smartUnion([
        ToolReferenceChunk$outboundSchema,
        TextChunk$outboundSchema,
        ReferenceChunk$outboundSchema,
    ])),
    signature: z.nullable(z.string()).optional(),
    closed: z.boolean().optional(),
});
export function thinkChunkToJSON(thinkChunk) {
    return JSON.stringify(ThinkChunk$outboundSchema.parse(thinkChunk));
}
export function thinkChunkFromJSON(jsonString) {
    return safeParse(jsonString, (x) => ThinkChunk$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ThinkChunk' from JSON`);
}
//# sourceMappingURL=thinkchunk.js.map