"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateConversationResponseResponseBody$inboundSchema = exports.ResponseStreamingEvent$inboundSchema = exports.PartDeltaEvent$inboundSchema = exports.ResponseStreamingEventData$inboundSchema = exports.ReasoningPart$inboundSchema = exports.DeltaKind$inboundSchema = exports.ResponseStreamingEventType$inboundSchema = exports.PartDoneEvent$inboundSchema = exports.CreateConversationResponseResponseStreamingEventData$inboundSchema = exports.PartReasoningPart$inboundSchema = exports.PartKind$inboundSchema = exports.CreateConversationResponseResponseStreamingEventType$inboundSchema = exports.CreateConversationResponseRequest$outboundSchema = exports.CreateConversationResponseRequestBody$outboundSchema = exports.DeltaKind = exports.ResponseStreamingEventType = exports.PartKind = exports.CreateConversationResponseResponseStreamingEventType = void 0;
exports.createConversationResponseRequestBodyToJSON = createConversationResponseRequestBodyToJSON;
exports.createConversationResponseRequestToJSON = createConversationResponseRequestToJSON;
exports.partReasoningPartFromJSON = partReasoningPartFromJSON;
exports.createConversationResponseResponseStreamingEventDataFromJSON = createConversationResponseResponseStreamingEventDataFromJSON;
exports.partDoneEventFromJSON = partDoneEventFromJSON;
exports.reasoningPartFromJSON = reasoningPartFromJSON;
exports.responseStreamingEventDataFromJSON = responseStreamingEventDataFromJSON;
exports.partDeltaEventFromJSON = partDeltaEventFromJSON;
exports.responseStreamingEventFromJSON = responseStreamingEventFromJSON;
exports.createConversationResponseResponseBodyFromJSON = createConversationResponseResponseBodyFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const components = __importStar(require("../components/index.js"));
exports.CreateConversationResponseResponseStreamingEventType = {
    PartDone: "part.done",
};
/**
 * Type discriminator indicating this is a reasoning part
 */
exports.PartKind = {
    Reasoning: "reasoning",
};
exports.ResponseStreamingEventType = {
    PartDelta: "part.delta",
};
/**
 * Type discriminator indicating this is a reasoning part
 */
exports.DeltaKind = {
    Reasoning: "reasoning",
};
/** @internal */
exports.CreateConversationResponseRequestBody$outboundSchema = z.object({
    message: components.UserMessageRequest$outboundSchema,
    model: z.string(),
    taskId: z.string().optional(),
    stream: z.boolean().default(true),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        taskId: "task_id",
    });
});
function createConversationResponseRequestBodyToJSON(createConversationResponseRequestBody) {
    return JSON.stringify(exports.CreateConversationResponseRequestBody$outboundSchema.parse(createConversationResponseRequestBody));
}
/** @internal */
exports.CreateConversationResponseRequest$outboundSchema = z.object({
    conversationId: z.string(),
    requestBody: z.lazy(() => exports.CreateConversationResponseRequestBody$outboundSchema),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        conversationId: "conversation_id",
        requestBody: "RequestBody",
    });
});
function createConversationResponseRequestToJSON(createConversationResponseRequest) {
    return JSON.stringify(exports.CreateConversationResponseRequest$outboundSchema.parse(createConversationResponseRequest));
}
/** @internal */
exports.CreateConversationResponseResponseStreamingEventType$inboundSchema = z.nativeEnum(exports.CreateConversationResponseResponseStreamingEventType);
/** @internal */
exports.PartKind$inboundSchema = z
    .nativeEnum(exports.PartKind);
/** @internal */
exports.PartReasoningPart$inboundSchema = z.object({
    _id: z.string().default("reasoning_01khy5sdgmrymnyzx56vrfyzqz"),
    metadata: z.record(z.any()).optional(),
    kind: exports.PartKind$inboundSchema,
    reasoning: z.string(),
    signature: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "_id": "id",
    });
});
function partReasoningPartFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.PartReasoningPart$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PartReasoningPart' from JSON`);
}
/** @internal */
exports.CreateConversationResponseResponseStreamingEventData$inboundSchema = z.object({
    partId: z.string(),
    part: z.any().optional(),
});
function createConversationResponseResponseStreamingEventDataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateConversationResponseResponseStreamingEventData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateConversationResponseResponseStreamingEventData' from JSON`);
}
/** @internal */
exports.PartDoneEvent$inboundSchema = z.object({
    type: exports.CreateConversationResponseResponseStreamingEventType$inboundSchema,
    timestamp: z.string(),
    data: z.lazy(() => exports.CreateConversationResponseResponseStreamingEventData$inboundSchema),
});
function partDoneEventFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.PartDoneEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PartDoneEvent' from JSON`);
}
/** @internal */
exports.ResponseStreamingEventType$inboundSchema = z.nativeEnum(exports.ResponseStreamingEventType);
/** @internal */
exports.DeltaKind$inboundSchema = z
    .nativeEnum(exports.DeltaKind);
/** @internal */
exports.ReasoningPart$inboundSchema = z.object({
    _id: z.string().default("reasoning_01khy5sdghj1f6gbcgtkrfwtka"),
    metadata: z.record(z.any()).optional(),
    kind: exports.DeltaKind$inboundSchema,
    reasoning: z.string(),
    signature: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "_id": "id",
    });
});
function reasoningPartFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ReasoningPart$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReasoningPart' from JSON`);
}
/** @internal */
exports.ResponseStreamingEventData$inboundSchema = z.object({
    partId: z.string(),
    delta: z.any().optional(),
});
function responseStreamingEventDataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseStreamingEventData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseStreamingEventData' from JSON`);
}
/** @internal */
exports.PartDeltaEvent$inboundSchema = z.object({
    type: exports.ResponseStreamingEventType$inboundSchema,
    timestamp: z.string(),
    data: z.lazy(() => exports.ResponseStreamingEventData$inboundSchema),
});
function partDeltaEventFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.PartDeltaEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PartDeltaEvent' from JSON`);
}
/** @internal */
exports.ResponseStreamingEvent$inboundSchema = z.union([
    components.ResponseStartedEvent$inboundSchema,
    components.ResponseDoneEvent$inboundSchema,
    components.ResponseFailedEvent$inboundSchema,
    components.ToolStartedEvent$inboundSchema,
    components.ToolDoneEvent$inboundSchema,
    components.ToolFailedEvent$inboundSchema,
    components.ToolReviewRequestedEvent$inboundSchema,
    components.ToolReviewDoneEvent$inboundSchema,
    components.PartDeltaEvent$inboundSchema,
    components.PartDoneEvent$inboundSchema,
]);
function responseStreamingEventFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseStreamingEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseStreamingEvent' from JSON`);
}
/** @internal */
exports.CreateConversationResponseResponseBody$inboundSchema = z.object({
    data: z.string().optional().transform((v, ctx) => {
        if (v === undefined)
            return undefined;
        try {
            return JSON.parse(v);
        }
        catch (err) {
            ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
            return z.NEVER;
        }
    }).pipe(z.union([
        components.ResponseStartedEvent$inboundSchema,
        components.ResponseDoneEvent$inboundSchema,
        components.ResponseFailedEvent$inboundSchema,
        components.ToolStartedEvent$inboundSchema,
        components.ToolDoneEvent$inboundSchema,
        components.ToolFailedEvent$inboundSchema,
        components.ToolReviewRequestedEvent$inboundSchema,
        components.ToolReviewDoneEvent$inboundSchema,
        components.PartDeltaEvent$inboundSchema,
        components.PartDoneEvent$inboundSchema,
    ]).optional()),
});
function createConversationResponseResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateConversationResponseResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateConversationResponseResponseBody' from JSON`);
}
//# sourceMappingURL=createconversationresponse.js.map