"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.CreateAgentResponse$inboundSchema = exports.PendingToolCalls$inboundSchema = exports.FunctionT$inboundSchema = exports.CreateAgentResponseType$inboundSchema = exports.FinishReason$inboundSchema = exports.Usage$inboundSchema = exports.CompletionTokensDetails$inboundSchema = exports.PromptTokensDetails$inboundSchema = exports.CreateAgentResponseType = exports.FinishReason = void 0;
exports.promptTokensDetailsFromJSON = promptTokensDetailsFromJSON;
exports.completionTokensDetailsFromJSON = completionTokensDetailsFromJSON;
exports.usageFromJSON = usageFromJSON;
exports.functionFromJSON = functionFromJSON;
exports.pendingToolCallsFromJSON = pendingToolCallsFromJSON;
exports.createAgentResponseFromJSON = createAgentResponseFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const agentresponsemessage_js_1 = require("./agentresponsemessage.js");
const telemetry_js_1 = require("./telemetry.js");
/**
 * The reason why the agent stopped generating
 */
exports.FinishReason = {
    Stop: "stop",
    Length: "length",
    ToolCalls: "tool_calls",
    ContentFilter: "content_filter",
    FunctionCall: "function_call",
    MaxIterations: "max_iterations",
    MaxTime: "max_time",
};
exports.CreateAgentResponseType = {
    Function: "function",
};
/** @internal */
exports.PromptTokensDetails$inboundSchema = z.object({
    cached_tokens: z.nullable(z.number().int()).optional(),
    cache_creation_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",
        "cache_creation_tokens": "cacheCreationTokens",
        "audio_tokens": "audioTokens",
    });
});
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",
    });
});
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.Usage$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",
    });
});
function usageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Usage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Usage' from JSON`);
}
/** @internal */
exports.FinishReason$inboundSchema = z.nativeEnum(exports.FinishReason);
/** @internal */
exports.CreateAgentResponseType$inboundSchema = z.nativeEnum(exports.CreateAgentResponseType);
/** @internal */
exports.FunctionT$inboundSchema = z.object({
    name: z.string().optional(),
    arguments: z.string().optional(),
});
function functionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.FunctionT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FunctionT' from JSON`);
}
/** @internal */
exports.PendingToolCalls$inboundSchema = z.object({
    id: z.string(),
    type: exports.CreateAgentResponseType$inboundSchema,
    function: z.lazy(() => exports.FunctionT$inboundSchema),
});
function pendingToolCallsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.PendingToolCalls$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PendingToolCalls' from JSON`);
}
/** @internal */
exports.CreateAgentResponse$inboundSchema = z.object({
    _id: z.string(),
    task_id: z.string(),
    output: z.array(agentresponsemessage_js_1.AgentResponseMessage$inboundSchema),
    created_at: z.string(),
    model: z.string(),
    usage: z.nullable(z.lazy(() => exports.Usage$inboundSchema)).optional(),
    finish_reason: exports.FinishReason$inboundSchema.optional(),
    pending_tool_calls: z.array(z.lazy(() => exports.PendingToolCalls$inboundSchema))
        .optional(),
    telemetry: telemetry_js_1.Telemetry$inboundSchema.optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "_id": "id",
        "task_id": "taskId",
        "created_at": "createdAt",
        "finish_reason": "finishReason",
        "pending_tool_calls": "pendingToolCalls",
    });
});
function createAgentResponseFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateAgentResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateAgentResponse' from JSON`);
}
//# sourceMappingURL=createagentresponse.js.map