"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.ResponseDoneEvent$inboundSchema = exports.ResponseDoneEventData$inboundSchema = exports.ResponseDoneEventPendingToolCalls$inboundSchema = exports.ResponseDoneEventFunction$inboundSchema = exports.ResponseDoneEventDataType$inboundSchema = exports.ResponseDoneEventUsage$inboundSchema = exports.ResponseDoneEventCompletionTokensDetails$inboundSchema = exports.ResponseDoneEventPromptTokensDetails$inboundSchema = exports.ResponseDoneEventFinishReason$inboundSchema = exports.ResponseDoneEventDataType = exports.ResponseDoneEventFinishReason = void 0;
exports.responseDoneEventPromptTokensDetailsFromJSON = responseDoneEventPromptTokensDetailsFromJSON;
exports.responseDoneEventCompletionTokensDetailsFromJSON = responseDoneEventCompletionTokensDetailsFromJSON;
exports.responseDoneEventUsageFromJSON = responseDoneEventUsageFromJSON;
exports.responseDoneEventFunctionFromJSON = responseDoneEventFunctionFromJSON;
exports.responseDoneEventPendingToolCallsFromJSON = responseDoneEventPendingToolCallsFromJSON;
exports.responseDoneEventDataFromJSON = responseDoneEventDataFromJSON;
exports.responseDoneEventFromJSON = responseDoneEventFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const telemetry_js_1 = require("./telemetry.js");
/**
 * The reason why the agent stopped generating
 */
exports.ResponseDoneEventFinishReason = {
    Stop: "stop",
    Length: "length",
    ToolCalls: "tool_calls",
    ContentFilter: "content_filter",
    FunctionCall: "function_call",
    MaxIterations: "max_iterations",
    MaxTime: "max_time",
};
exports.ResponseDoneEventDataType = {
    Function: "function",
};
/** @internal */
exports.ResponseDoneEventFinishReason$inboundSchema = z.nativeEnum(exports.ResponseDoneEventFinishReason);
/** @internal */
exports.ResponseDoneEventPromptTokensDetails$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 responseDoneEventPromptTokensDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseDoneEventPromptTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseDoneEventPromptTokensDetails' from JSON`);
}
/** @internal */
exports.ResponseDoneEventCompletionTokensDetails$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 responseDoneEventCompletionTokensDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseDoneEventCompletionTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseDoneEventCompletionTokensDetails' from JSON`);
}
/** @internal */
exports.ResponseDoneEventUsage$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.ResponseDoneEventPromptTokensDetails$inboundSchema)).optional(),
    completion_tokens_details: z.nullable(z.lazy(() => exports.ResponseDoneEventCompletionTokensDetails$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 responseDoneEventUsageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseDoneEventUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseDoneEventUsage' from JSON`);
}
/** @internal */
exports.ResponseDoneEventDataType$inboundSchema = z.nativeEnum(exports.ResponseDoneEventDataType);
/** @internal */
exports.ResponseDoneEventFunction$inboundSchema = z.object({
    name: z.string().optional(),
    arguments: z.string().optional(),
});
function responseDoneEventFunctionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseDoneEventFunction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseDoneEventFunction' from JSON`);
}
/** @internal */
exports.ResponseDoneEventPendingToolCalls$inboundSchema = z.object({
    id: z.string(),
    type: exports.ResponseDoneEventDataType$inboundSchema,
    function: z.lazy(() => exports.ResponseDoneEventFunction$inboundSchema),
});
function responseDoneEventPendingToolCallsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseDoneEventPendingToolCalls$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseDoneEventPendingToolCalls' from JSON`);
}
/** @internal */
exports.ResponseDoneEventData$inboundSchema = z.object({
    finishReason: exports.ResponseDoneEventFinishReason$inboundSchema,
    usage: z.lazy(() => exports.ResponseDoneEventUsage$inboundSchema).optional(),
    pendingToolCalls: z.array(z.lazy(() => exports.ResponseDoneEventPendingToolCalls$inboundSchema)).optional(),
    telemetry: telemetry_js_1.Telemetry$inboundSchema.optional(),
});
function responseDoneEventDataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseDoneEventData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseDoneEventData' from JSON`);
}
/** @internal */
exports.ResponseDoneEvent$inboundSchema = z.object({
    type: z.literal("response.done"),
    timestamp: z.string(),
    data: z.lazy(() => exports.ResponseDoneEventData$inboundSchema),
});
function responseDoneEventFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseDoneEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseDoneEvent' from JSON`);
}
//# sourceMappingURL=responsedoneevent.js.map