"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.CreateAgentResponseRequestUsage$inboundSchema = exports.CompletionTokensDetails$outboundSchema = exports.CompletionTokensDetails$inboundSchema = exports.PromptTokensDetails$outboundSchema = exports.PromptTokensDetails$inboundSchema = exports.Output$outboundSchema = exports.Output$inboundSchema = exports.Parts$outboundSchema = exports.Parts$inboundSchema = exports.CreateAgentResponseRequestAgentsResponsesRole$outboundSchema = exports.CreateAgentResponseRequestAgentsResponsesRole$inboundSchema = exports.CreateAgentResponseRequestRequest$outboundSchema = exports.CreateAgentResponseRequestRequest$inboundSchema = exports.CreateAgentResponseRequestRequestBody$outboundSchema = exports.CreateAgentResponseRequestRequestBody$inboundSchema = exports.Memory$outboundSchema = exports.Memory$inboundSchema = exports.CreateAgentResponseRequestThread$outboundSchema = exports.CreateAgentResponseRequestThread$inboundSchema = exports.Contact$outboundSchema = exports.Contact$inboundSchema = exports.A2AMessage$outboundSchema = exports.A2AMessage$inboundSchema = exports.PublicMessagePart$outboundSchema = exports.PublicMessagePart$inboundSchema = exports.FilePart$outboundSchema = exports.FilePart$inboundSchema = exports.PublicMessagePartFile$outboundSchema = exports.PublicMessagePartFile$inboundSchema = exports.BinaryFormat$outboundSchema = exports.BinaryFormat$inboundSchema = exports.FileInURIFormat$outboundSchema = exports.FileInURIFormat$inboundSchema = exports.Kind$outboundSchema = exports.Kind$inboundSchema = exports.ToolResultPart$outboundSchema = exports.ToolResultPart$inboundSchema = exports.PublicMessagePartKind$outboundSchema = exports.PublicMessagePartKind$inboundSchema = exports.CreateAgentResponseRequestRole$outboundSchema = exports.CreateAgentResponseRequestRole$inboundSchema = exports.RoleUserMessage$outboundSchema = exports.RoleUserMessage$inboundSchema = exports.RoleToolMessage$outboundSchema = exports.RoleToolMessage$inboundSchema = exports.CreateAgentResponseRequestAgentsResponsesRole = exports.Kind = exports.PublicMessagePartKind = exports.RoleUserMessage = exports.RoleToolMessage = void 0;
exports.CreateAgentResponseRequestResponseBody$outboundSchema = exports.CreateAgentResponseRequestResponseBody$inboundSchema = exports.CreateAgentResponseRequestUsage$outboundSchema = void 0;
exports.createAgentResponseRequestRoleToJSON = createAgentResponseRequestRoleToJSON;
exports.createAgentResponseRequestRoleFromJSON = createAgentResponseRequestRoleFromJSON;
exports.toolResultPartToJSON = toolResultPartToJSON;
exports.toolResultPartFromJSON = toolResultPartFromJSON;
exports.fileInURIFormatToJSON = fileInURIFormatToJSON;
exports.fileInURIFormatFromJSON = fileInURIFormatFromJSON;
exports.binaryFormatToJSON = binaryFormatToJSON;
exports.binaryFormatFromJSON = binaryFormatFromJSON;
exports.publicMessagePartFileToJSON = publicMessagePartFileToJSON;
exports.publicMessagePartFileFromJSON = publicMessagePartFileFromJSON;
exports.filePartToJSON = filePartToJSON;
exports.filePartFromJSON = filePartFromJSON;
exports.publicMessagePartToJSON = publicMessagePartToJSON;
exports.publicMessagePartFromJSON = publicMessagePartFromJSON;
exports.a2AMessageToJSON = a2AMessageToJSON;
exports.a2AMessageFromJSON = a2AMessageFromJSON;
exports.contactToJSON = contactToJSON;
exports.contactFromJSON = contactFromJSON;
exports.createAgentResponseRequestThreadToJSON = createAgentResponseRequestThreadToJSON;
exports.createAgentResponseRequestThreadFromJSON = createAgentResponseRequestThreadFromJSON;
exports.memoryToJSON = memoryToJSON;
exports.memoryFromJSON = memoryFromJSON;
exports.createAgentResponseRequestRequestBodyToJSON = createAgentResponseRequestRequestBodyToJSON;
exports.createAgentResponseRequestRequestBodyFromJSON = createAgentResponseRequestRequestBodyFromJSON;
exports.createAgentResponseRequestRequestToJSON = createAgentResponseRequestRequestToJSON;
exports.createAgentResponseRequestRequestFromJSON = createAgentResponseRequestRequestFromJSON;
exports.partsToJSON = partsToJSON;
exports.partsFromJSON = partsFromJSON;
exports.outputToJSON = outputToJSON;
exports.outputFromJSON = outputFromJSON;
exports.promptTokensDetailsToJSON = promptTokensDetailsToJSON;
exports.promptTokensDetailsFromJSON = promptTokensDetailsFromJSON;
exports.completionTokensDetailsToJSON = completionTokensDetailsToJSON;
exports.completionTokensDetailsFromJSON = completionTokensDetailsFromJSON;
exports.createAgentResponseRequestUsageToJSON = createAgentResponseRequestUsageToJSON;
exports.createAgentResponseRequestUsageFromJSON = createAgentResponseRequestUsageFromJSON;
exports.createAgentResponseRequestResponseBodyToJSON = createAgentResponseRequestResponseBodyToJSON;
exports.createAgentResponseRequestResponseBodyFromJSON = createAgentResponseRequestResponseBodyFromJSON;
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"));
/**
 * Message containing tool execution results
 */
exports.RoleToolMessage = {
    Tool: "tool",
};
/**
 * Message from the end user
 */
exports.RoleUserMessage = {
    User: "user",
};
exports.PublicMessagePartKind = {
    ToolResult: "tool_result",
};
exports.Kind = {
    File: "file",
};
exports.CreateAgentResponseRequestAgentsResponsesRole = {
    User: "user",
    Agent: "agent",
    Tool: "tool",
    System: "system",
};
/** @internal */
exports.RoleToolMessage$inboundSchema = z.nativeEnum(exports.RoleToolMessage);
/** @internal */
exports.RoleToolMessage$outboundSchema = exports.RoleToolMessage$inboundSchema;
/** @internal */
exports.RoleUserMessage$inboundSchema = z.nativeEnum(exports.RoleUserMessage);
/** @internal */
exports.RoleUserMessage$outboundSchema = exports.RoleUserMessage$inboundSchema;
/** @internal */
exports.CreateAgentResponseRequestRole$inboundSchema = z.union([exports.RoleUserMessage$inboundSchema, exports.RoleToolMessage$inboundSchema]);
/** @internal */
exports.CreateAgentResponseRequestRole$outboundSchema = z.union([exports.RoleUserMessage$outboundSchema, exports.RoleToolMessage$outboundSchema]);
function createAgentResponseRequestRoleToJSON(createAgentResponseRequestRole) {
    return JSON.stringify(exports.CreateAgentResponseRequestRole$outboundSchema.parse(createAgentResponseRequestRole));
}
function createAgentResponseRequestRoleFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateAgentResponseRequestRole$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAgentResponseRequestRole' from JSON`);
}
/** @internal */
exports.PublicMessagePartKind$inboundSchema = z.nativeEnum(exports.PublicMessagePartKind);
/** @internal */
exports.PublicMessagePartKind$outboundSchema = exports.PublicMessagePartKind$inboundSchema;
/** @internal */
exports.ToolResultPart$inboundSchema = z.object({
    kind: exports.PublicMessagePartKind$inboundSchema,
    tool_call_id: z.string(),
    result: z.any().optional(),
    metadata: z.record(z.any()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "tool_call_id": "toolCallId",
    });
});
/** @internal */
exports.ToolResultPart$outboundSchema = z.object({
    kind: exports.PublicMessagePartKind$outboundSchema,
    toolCallId: z.string(),
    result: z.any().optional(),
    metadata: z.record(z.any()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        toolCallId: "tool_call_id",
    });
});
function toolResultPartToJSON(toolResultPart) {
    return JSON.stringify(exports.ToolResultPart$outboundSchema.parse(toolResultPart));
}
function toolResultPartFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ToolResultPart$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ToolResultPart' from JSON`);
}
/** @internal */
exports.Kind$inboundSchema = z.nativeEnum(exports.Kind);
/** @internal */
exports.Kind$outboundSchema = exports.Kind$inboundSchema;
/** @internal */
exports.FileInURIFormat$inboundSchema = z.object({
    uri: z.string(),
    mimeType: z.string().optional(),
    name: z.string().optional(),
});
/** @internal */
exports.FileInURIFormat$outboundSchema = z.object({
    uri: z.string(),
    mimeType: z.string().optional(),
    name: z.string().optional(),
});
function fileInURIFormatToJSON(fileInURIFormat) {
    return JSON.stringify(exports.FileInURIFormat$outboundSchema.parse(fileInURIFormat));
}
function fileInURIFormatFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.FileInURIFormat$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FileInURIFormat' from JSON`);
}
/** @internal */
exports.BinaryFormat$inboundSchema = z.object({
    bytes: z.string(),
    mimeType: z.string().optional(),
    name: z.string().optional(),
});
/** @internal */
exports.BinaryFormat$outboundSchema = z.object({
    bytes: z.string(),
    mimeType: z.string().optional(),
    name: z.string().optional(),
});
function binaryFormatToJSON(binaryFormat) {
    return JSON.stringify(exports.BinaryFormat$outboundSchema.parse(binaryFormat));
}
function binaryFormatFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.BinaryFormat$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BinaryFormat' from JSON`);
}
/** @internal */
exports.PublicMessagePartFile$inboundSchema = z.union([
    z.lazy(() => exports.BinaryFormat$inboundSchema),
    z.lazy(() => exports.FileInURIFormat$inboundSchema),
]);
/** @internal */
exports.PublicMessagePartFile$outboundSchema = z.union([
    z.lazy(() => exports.BinaryFormat$outboundSchema),
    z.lazy(() => exports.FileInURIFormat$outboundSchema),
]);
function publicMessagePartFileToJSON(publicMessagePartFile) {
    return JSON.stringify(exports.PublicMessagePartFile$outboundSchema.parse(publicMessagePartFile));
}
function publicMessagePartFileFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.PublicMessagePartFile$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PublicMessagePartFile' from JSON`);
}
/** @internal */
exports.FilePart$inboundSchema = z.object({
    kind: exports.Kind$inboundSchema,
    file: z.union([
        z.lazy(() => exports.BinaryFormat$inboundSchema),
        z.lazy(() => exports.FileInURIFormat$inboundSchema),
    ]),
    metadata: z.record(z.any()).optional(),
});
/** @internal */
exports.FilePart$outboundSchema = z.object({
    kind: exports.Kind$outboundSchema,
    file: z.union([
        z.lazy(() => exports.BinaryFormat$outboundSchema),
        z.lazy(() => exports.FileInURIFormat$outboundSchema),
    ]),
    metadata: z.record(z.any()).optional(),
});
function filePartToJSON(filePart) {
    return JSON.stringify(exports.FilePart$outboundSchema.parse(filePart));
}
function filePartFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.FilePart$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FilePart' from JSON`);
}
/** @internal */
exports.PublicMessagePart$inboundSchema = z.union([
    components.TextPart$inboundSchema,
    z.lazy(() => exports.FilePart$inboundSchema),
    z.lazy(() => exports.ToolResultPart$inboundSchema),
]);
/** @internal */
exports.PublicMessagePart$outboundSchema = z.union([
    components.TextPart$outboundSchema,
    z.lazy(() => exports.FilePart$outboundSchema),
    z.lazy(() => exports.ToolResultPart$outboundSchema),
]);
function publicMessagePartToJSON(publicMessagePart) {
    return JSON.stringify(exports.PublicMessagePart$outboundSchema.parse(publicMessagePart));
}
function publicMessagePartFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.PublicMessagePart$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PublicMessagePart' from JSON`);
}
/** @internal */
exports.A2AMessage$inboundSchema = z.object({
    messageId: z.string().optional(),
    role: z.union([exports.RoleUserMessage$inboundSchema, exports.RoleToolMessage$inboundSchema]),
    parts: z.array(z.union([
        components.TextPart$inboundSchema,
        z.lazy(() => exports.FilePart$inboundSchema),
        z.lazy(() => exports.ToolResultPart$inboundSchema),
    ])),
});
/** @internal */
exports.A2AMessage$outboundSchema = z.object({
    messageId: z.string().optional(),
    role: z.union([
        exports.RoleUserMessage$outboundSchema,
        exports.RoleToolMessage$outboundSchema,
    ]),
    parts: z.array(z.union([
        components.TextPart$outboundSchema,
        z.lazy(() => exports.FilePart$outboundSchema),
        z.lazy(() => exports.ToolResultPart$outboundSchema),
    ])),
});
function a2AMessageToJSON(a2AMessage) {
    return JSON.stringify(exports.A2AMessage$outboundSchema.parse(a2AMessage));
}
function a2AMessageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.A2AMessage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'A2AMessage' from JSON`);
}
/** @internal */
exports.Contact$inboundSchema = z.object({
    id: z.string(),
    display_name: z.string().optional(),
    email: z.string().optional(),
    metadata: z.array(z.record(z.any())).optional(),
    logo_url: z.string().optional(),
    tags: z.array(z.string()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "display_name": "displayName",
        "logo_url": "logoUrl",
    });
});
/** @internal */
exports.Contact$outboundSchema = z.object({
    id: z.string(),
    displayName: z.string().optional(),
    email: z.string().optional(),
    metadata: z.array(z.record(z.any())).optional(),
    logoUrl: z.string().optional(),
    tags: z.array(z.string()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        displayName: "display_name",
        logoUrl: "logo_url",
    });
});
function contactToJSON(contact) {
    return JSON.stringify(exports.Contact$outboundSchema.parse(contact));
}
function contactFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Contact$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Contact' from JSON`);
}
/** @internal */
exports.CreateAgentResponseRequestThread$inboundSchema = z.object({
    id: z.string(),
    tags: z.array(z.string()).optional(),
});
/** @internal */
exports.CreateAgentResponseRequestThread$outboundSchema = z.object({
    id: z.string(),
    tags: z.array(z.string()).optional(),
});
function createAgentResponseRequestThreadToJSON(createAgentResponseRequestThread) {
    return JSON.stringify(exports.CreateAgentResponseRequestThread$outboundSchema.parse(createAgentResponseRequestThread));
}
function createAgentResponseRequestThreadFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateAgentResponseRequestThread$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAgentResponseRequestThread' from JSON`);
}
/** @internal */
exports.Memory$inboundSchema = z
    .object({
    entity_id: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "entity_id": "entityId",
    });
});
/** @internal */
exports.Memory$outboundSchema = z.object({
    entityId: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        entityId: "entity_id",
    });
});
function memoryToJSON(memory) {
    return JSON.stringify(exports.Memory$outboundSchema.parse(memory));
}
function memoryFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Memory$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Memory' from JSON`);
}
/** @internal */
exports.CreateAgentResponseRequestRequestBody$inboundSchema = z.object({
    task_id: z.string().optional(),
    message: z.lazy(() => exports.A2AMessage$inboundSchema),
    variables: z.record(z.any()).optional(),
    contact: z.lazy(() => exports.Contact$inboundSchema).optional(),
    thread: z.lazy(() => exports.CreateAgentResponseRequestThread$inboundSchema)
        .optional(),
    memory: z.lazy(() => exports.Memory$inboundSchema).optional(),
    metadata: z.record(z.any()).optional(),
    background: z.boolean().default(false),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "task_id": "taskId",
    });
});
/** @internal */
exports.CreateAgentResponseRequestRequestBody$outboundSchema = z.object({
    taskId: z.string().optional(),
    message: z.lazy(() => exports.A2AMessage$outboundSchema),
    variables: z.record(z.any()).optional(),
    contact: z.lazy(() => exports.Contact$outboundSchema).optional(),
    thread: z.lazy(() => exports.CreateAgentResponseRequestThread$outboundSchema)
        .optional(),
    memory: z.lazy(() => exports.Memory$outboundSchema).optional(),
    metadata: z.record(z.any()).optional(),
    background: z.boolean().default(false),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        taskId: "task_id",
    });
});
function createAgentResponseRequestRequestBodyToJSON(createAgentResponseRequestRequestBody) {
    return JSON.stringify(exports.CreateAgentResponseRequestRequestBody$outboundSchema.parse(createAgentResponseRequestRequestBody));
}
function createAgentResponseRequestRequestBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateAgentResponseRequestRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAgentResponseRequestRequestBody' from JSON`);
}
/** @internal */
exports.CreateAgentResponseRequestRequest$inboundSchema = z.object({
    agent_key: z.string(),
    RequestBody: z.lazy(() => exports.CreateAgentResponseRequestRequestBody$inboundSchema),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "agent_key": "agentKey",
        "RequestBody": "requestBody",
    });
});
/** @internal */
exports.CreateAgentResponseRequestRequest$outboundSchema = z.object({
    agentKey: z.string(),
    requestBody: z.lazy(() => exports.CreateAgentResponseRequestRequestBody$outboundSchema),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        agentKey: "agent_key",
        requestBody: "RequestBody",
    });
});
function createAgentResponseRequestRequestToJSON(createAgentResponseRequestRequest) {
    return JSON.stringify(exports.CreateAgentResponseRequestRequest$outboundSchema.parse(createAgentResponseRequestRequest));
}
function createAgentResponseRequestRequestFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateAgentResponseRequestRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAgentResponseRequestRequest' from JSON`);
}
/** @internal */
exports.CreateAgentResponseRequestAgentsResponsesRole$inboundSchema = z
    .nativeEnum(exports.CreateAgentResponseRequestAgentsResponsesRole);
/** @internal */
exports.CreateAgentResponseRequestAgentsResponsesRole$outboundSchema = exports.CreateAgentResponseRequestAgentsResponsesRole$inboundSchema;
/** @internal */
exports.Parts$inboundSchema = z
    .union([
    components.ToolCallPart$inboundSchema.and(z.object({ kind: z.literal("tool_call") }).transform((v) => ({
        kind: v.kind,
    }))),
    components.TextPart$inboundSchema.and(z.object({ kind: z.literal("text") }).transform((v) => ({
        kind: v.kind,
    }))),
    components.DataPart$inboundSchema.and(z.object({ kind: z.literal("data") }).transform((v) => ({
        kind: v.kind,
    }))),
    components.FilePart$inboundSchema.and(z.object({ kind: z.literal("file") }).transform((v) => ({
        kind: v.kind,
    }))),
    components.ToolResultPart$inboundSchema.and(z.object({ kind: z.literal("tool_result") }).transform((v) => ({
        kind: v.kind,
    }))),
]);
/** @internal */
exports.Parts$outboundSchema = z.union([
    components.ToolCallPart$outboundSchema.and(z.object({ kind: z.literal("tool_call") }).transform((v) => ({
        kind: v.kind,
    }))),
    components.TextPart$outboundSchema.and(z.object({ kind: z.literal("text") }).transform((v) => ({ kind: v.kind }))),
    components.DataPart$outboundSchema.and(z.object({ kind: z.literal("data") }).transform((v) => ({ kind: v.kind }))),
    components.FilePart$outboundSchema.and(z.object({ kind: z.literal("file") }).transform((v) => ({ kind: v.kind }))),
    components.ToolResultPart$outboundSchema.and(z.object({ kind: z.literal("tool_result") }).transform((v) => ({
        kind: v.kind,
    }))),
]);
function partsToJSON(parts) {
    return JSON.stringify(exports.Parts$outboundSchema.parse(parts));
}
function partsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Parts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Parts' from JSON`);
}
/** @internal */
exports.Output$inboundSchema = z
    .object({
    messageId: z.string(),
    role: exports.CreateAgentResponseRequestAgentsResponsesRole$inboundSchema,
    parts: z.array(z.union([
        components.ToolCallPart$inboundSchema.and(z.object({ kind: z.literal("tool_call") }).transform((v) => ({
            kind: v.kind,
        }))),
        components.TextPart$inboundSchema.and(z.object({ kind: z.literal("text") }).transform((v) => ({
            kind: v.kind,
        }))),
        components.DataPart$inboundSchema.and(z.object({ kind: z.literal("data") }).transform((v) => ({
            kind: v.kind,
        }))),
        components.FilePart$inboundSchema.and(z.object({ kind: z.literal("file") }).transform((v) => ({
            kind: v.kind,
        }))),
        components.ToolResultPart$inboundSchema.and(z.object({ kind: z.literal("tool_result") }).transform((v) => ({
            kind: v.kind,
        }))),
    ])),
    metadata: z.record(z.any()).optional(),
});
/** @internal */
exports.Output$outboundSchema = z.object({
    messageId: z.string(),
    role: exports.CreateAgentResponseRequestAgentsResponsesRole$outboundSchema,
    parts: z.array(z.union([
        components.ToolCallPart$outboundSchema.and(z.object({ kind: z.literal("tool_call") }).transform((v) => ({
            kind: v.kind,
        }))),
        components.TextPart$outboundSchema.and(z.object({ kind: z.literal("text") }).transform((v) => ({
            kind: v.kind,
        }))),
        components.DataPart$outboundSchema.and(z.object({ kind: z.literal("data") }).transform((v) => ({
            kind: v.kind,
        }))),
        components.FilePart$outboundSchema.and(z.object({ kind: z.literal("file") }).transform((v) => ({
            kind: v.kind,
        }))),
        components.ToolResultPart$outboundSchema.and(z.object({ kind: z.literal("tool_result") }).transform((v) => ({
            kind: v.kind,
        }))),
    ])),
    metadata: z.record(z.any()).optional(),
});
function outputToJSON(output) {
    return JSON.stringify(exports.Output$outboundSchema.parse(output));
}
function outputFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Output$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Output' from JSON`);
}
/** @internal */
exports.PromptTokensDetails$inboundSchema = z.object({
    cached_tokens: z.nullable(z.number().int()).optional(),
    audio_tokens: z.nullable(z.number().int()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "cached_tokens": "cachedTokens",
        "audio_tokens": "audioTokens",
    });
});
/** @internal */
exports.PromptTokensDetails$outboundSchema = z.object({
    cachedTokens: z.nullable(z.number().int()).optional(),
    audioTokens: z.nullable(z.number().int()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        cachedTokens: "cached_tokens",
        audioTokens: "audio_tokens",
    });
});
function promptTokensDetailsToJSON(promptTokensDetails) {
    return JSON.stringify(exports.PromptTokensDetails$outboundSchema.parse(promptTokensDetails));
}
function promptTokensDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.PromptTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PromptTokensDetails' from JSON`);
}
/** @internal */
exports.CompletionTokensDetails$inboundSchema = z.object({
    reasoning_tokens: z.nullable(z.number()).optional(),
    accepted_prediction_tokens: z.nullable(z.number()).optional(),
    rejected_prediction_tokens: z.nullable(z.number()).optional(),
    audio_tokens: z.nullable(z.number().int()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "reasoning_tokens": "reasoningTokens",
        "accepted_prediction_tokens": "acceptedPredictionTokens",
        "rejected_prediction_tokens": "rejectedPredictionTokens",
        "audio_tokens": "audioTokens",
    });
});
/** @internal */
exports.CompletionTokensDetails$outboundSchema = z.object({
    reasoningTokens: z.nullable(z.number()).optional(),
    acceptedPredictionTokens: z.nullable(z.number()).optional(),
    rejectedPredictionTokens: z.nullable(z.number()).optional(),
    audioTokens: z.nullable(z.number().int()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        reasoningTokens: "reasoning_tokens",
        acceptedPredictionTokens: "accepted_prediction_tokens",
        rejectedPredictionTokens: "rejected_prediction_tokens",
        audioTokens: "audio_tokens",
    });
});
function completionTokensDetailsToJSON(completionTokensDetails) {
    return JSON.stringify(exports.CompletionTokensDetails$outboundSchema.parse(completionTokensDetails));
}
function completionTokensDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CompletionTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompletionTokensDetails' from JSON`);
}
/** @internal */
exports.CreateAgentResponseRequestUsage$inboundSchema = z.object({
    completion_tokens: z.number().optional(),
    prompt_tokens: z.number().optional(),
    total_tokens: z.number().optional(),
    prompt_tokens_details: z.nullable(z.lazy(() => exports.PromptTokensDetails$inboundSchema)).optional(),
    completion_tokens_details: z.nullable(z.lazy(() => exports.CompletionTokensDetails$inboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "completion_tokens": "completionTokens",
        "prompt_tokens": "promptTokens",
        "total_tokens": "totalTokens",
        "prompt_tokens_details": "promptTokensDetails",
        "completion_tokens_details": "completionTokensDetails",
    });
});
/** @internal */
exports.CreateAgentResponseRequestUsage$outboundSchema = z.object({
    completionTokens: z.number().optional(),
    promptTokens: z.number().optional(),
    totalTokens: z.number().optional(),
    promptTokensDetails: z.nullable(z.lazy(() => exports.PromptTokensDetails$outboundSchema)).optional(),
    completionTokensDetails: z.nullable(z.lazy(() => exports.CompletionTokensDetails$outboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        completionTokens: "completion_tokens",
        promptTokens: "prompt_tokens",
        totalTokens: "total_tokens",
        promptTokensDetails: "prompt_tokens_details",
        completionTokensDetails: "completion_tokens_details",
    });
});
function createAgentResponseRequestUsageToJSON(createAgentResponseRequestUsage) {
    return JSON.stringify(exports.CreateAgentResponseRequestUsage$outboundSchema.parse(createAgentResponseRequestUsage));
}
function createAgentResponseRequestUsageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateAgentResponseRequestUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAgentResponseRequestUsage' from JSON`);
}
/** @internal */
exports.CreateAgentResponseRequestResponseBody$inboundSchema = z.object({
    _id: z.string(),
    task_id: z.string(),
    output: z.array(z.lazy(() => exports.Output$inboundSchema)),
    created_at: z.string(),
    model: z.string(),
    usage: z.nullable(z.lazy(() => exports.CreateAgentResponseRequestUsage$inboundSchema))
        .optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "_id": "id",
        "task_id": "taskId",
        "created_at": "createdAt",
    });
});
/** @internal */
exports.CreateAgentResponseRequestResponseBody$outboundSchema = z.object({
    id: z.string(),
    taskId: z.string(),
    output: z.array(z.lazy(() => exports.Output$outboundSchema)),
    createdAt: z.string(),
    model: z.string(),
    usage: z.nullable(z.lazy(() => exports.CreateAgentResponseRequestUsage$outboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        id: "_id",
        taskId: "task_id",
        createdAt: "created_at",
    });
});
function createAgentResponseRequestResponseBodyToJSON(createAgentResponseRequestResponseBody) {
    return JSON.stringify(exports.CreateAgentResponseRequestResponseBody$outboundSchema.parse(createAgentResponseRequestResponseBody));
}
function createAgentResponseRequestResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateAgentResponseRequestResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAgentResponseRequestResponseBody' from JSON`);
}
//# sourceMappingURL=createagentresponserequest.js.map