"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.AgentInactiveStreamingEvent$inboundSchema = exports.AgentInactiveStreamingEventData$inboundSchema = exports.Billing$inboundSchema = exports.AgentInactiveStreamingEventUsage$inboundSchema = exports.AgentInactiveStreamingEventCompletionTokensDetails$inboundSchema = exports.AgentInactiveStreamingEventPromptTokensDetails$inboundSchema = exports.AgentInactiveStreamingEventPendingToolCalls$inboundSchema = exports.AgentInactiveStreamingEventFunction$inboundSchema = exports.AgentInactiveStreamingEventDataType$inboundSchema = exports.AgentInactiveStreamingEventFinishReason$inboundSchema = exports.LastMessageFull$inboundSchema = exports.AgentInactiveStreamingEventParts$inboundSchema = exports.AgentInactiveStreamingEventRole$inboundSchema = exports.AgentInactiveStreamingEventDataType = exports.AgentInactiveStreamingEventFinishReason = exports.AgentInactiveStreamingEventRole = void 0;
exports.agentInactiveStreamingEventPartsFromJSON = agentInactiveStreamingEventPartsFromJSON;
exports.lastMessageFullFromJSON = lastMessageFullFromJSON;
exports.agentInactiveStreamingEventFunctionFromJSON = agentInactiveStreamingEventFunctionFromJSON;
exports.agentInactiveStreamingEventPendingToolCallsFromJSON = agentInactiveStreamingEventPendingToolCallsFromJSON;
exports.agentInactiveStreamingEventPromptTokensDetailsFromJSON = agentInactiveStreamingEventPromptTokensDetailsFromJSON;
exports.agentInactiveStreamingEventCompletionTokensDetailsFromJSON = agentInactiveStreamingEventCompletionTokensDetailsFromJSON;
exports.agentInactiveStreamingEventUsageFromJSON = agentInactiveStreamingEventUsageFromJSON;
exports.billingFromJSON = billingFromJSON;
exports.agentInactiveStreamingEventDataFromJSON = agentInactiveStreamingEventDataFromJSON;
exports.agentInactiveStreamingEventFromJSON = agentInactiveStreamingEventFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const datapart_js_1 = require("./datapart.js");
const errorpart_js_1 = require("./errorpart.js");
const filepart_js_1 = require("./filepart.js");
const textpart_js_1 = require("./textpart.js");
const toolcallpart_js_1 = require("./toolcallpart.js");
const toolresultpart_js_1 = require("./toolresultpart.js");
/**
 * Extended A2A message role
 */
exports.AgentInactiveStreamingEventRole = {
    User: "user",
    Agent: "agent",
    Tool: "tool",
    System: "system",
};
/**
 * The reason why the agent execution became inactive
 */
exports.AgentInactiveStreamingEventFinishReason = {
    Stop: "stop",
    Length: "length",
    ToolCalls: "tool_calls",
    ContentFilter: "content_filter",
    FunctionCall: "function_call",
    MaxIterations: "max_iterations",
    MaxTime: "max_time",
};
exports.AgentInactiveStreamingEventDataType = {
    Function: "function",
};
/** @internal */
exports.AgentInactiveStreamingEventRole$inboundSchema = z.nativeEnum(exports.AgentInactiveStreamingEventRole);
/** @internal */
exports.AgentInactiveStreamingEventParts$inboundSchema = z.union([
    textpart_js_1.TextPart$inboundSchema,
    errorpart_js_1.ErrorPart$inboundSchema,
    datapart_js_1.DataPart$inboundSchema,
    filepart_js_1.FilePart$inboundSchema,
    toolcallpart_js_1.ToolCallPart$inboundSchema,
    toolresultpart_js_1.ToolResultPart$inboundSchema,
]);
function agentInactiveStreamingEventPartsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentInactiveStreamingEventParts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentInactiveStreamingEventParts' from JSON`);
}
/** @internal */
exports.LastMessageFull$inboundSchema = z.object({
    messageId: z.string().optional(),
    role: exports.AgentInactiveStreamingEventRole$inboundSchema,
    parts: z.array(z.union([
        textpart_js_1.TextPart$inboundSchema,
        errorpart_js_1.ErrorPart$inboundSchema,
        datapart_js_1.DataPart$inboundSchema,
        filepart_js_1.FilePart$inboundSchema,
        toolcallpart_js_1.ToolCallPart$inboundSchema,
        toolresultpart_js_1.ToolResultPart$inboundSchema,
    ])),
    metadata: z.record(z.any()).optional(),
});
function lastMessageFullFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.LastMessageFull$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LastMessageFull' from JSON`);
}
/** @internal */
exports.AgentInactiveStreamingEventFinishReason$inboundSchema = z
    .nativeEnum(exports.AgentInactiveStreamingEventFinishReason);
/** @internal */
exports.AgentInactiveStreamingEventDataType$inboundSchema = z.nativeEnum(exports.AgentInactiveStreamingEventDataType);
/** @internal */
exports.AgentInactiveStreamingEventFunction$inboundSchema = z.object({
    name: z.string().optional(),
    arguments: z.string().optional(),
});
function agentInactiveStreamingEventFunctionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentInactiveStreamingEventFunction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentInactiveStreamingEventFunction' from JSON`);
}
/** @internal */
exports.AgentInactiveStreamingEventPendingToolCalls$inboundSchema = z.object({
    id: z.string(),
    type: exports.AgentInactiveStreamingEventDataType$inboundSchema,
    function: z.lazy(() => exports.AgentInactiveStreamingEventFunction$inboundSchema),
});
function agentInactiveStreamingEventPendingToolCallsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentInactiveStreamingEventPendingToolCalls$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentInactiveStreamingEventPendingToolCalls' from JSON`);
}
/** @internal */
exports.AgentInactiveStreamingEventPromptTokensDetails$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 agentInactiveStreamingEventPromptTokensDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentInactiveStreamingEventPromptTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentInactiveStreamingEventPromptTokensDetails' from JSON`);
}
/** @internal */
exports.AgentInactiveStreamingEventCompletionTokensDetails$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 agentInactiveStreamingEventCompletionTokensDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentInactiveStreamingEventCompletionTokensDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentInactiveStreamingEventCompletionTokensDetails' from JSON`);
}
/** @internal */
exports.AgentInactiveStreamingEventUsage$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.AgentInactiveStreamingEventPromptTokensDetails$inboundSchema)).optional(),
    completion_tokens_details: z.nullable(z.lazy(() => exports.AgentInactiveStreamingEventCompletionTokensDetails$inboundSchema)).optional(),
    time_to_first_token: z.number().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",
        "time_to_first_token": "timeToFirstToken",
    });
});
function agentInactiveStreamingEventUsageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentInactiveStreamingEventUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentInactiveStreamingEventUsage' from JSON`);
}
/** @internal */
exports.Billing$inboundSchema = z.object({
    total_cost: z.number(),
    input_cost: z.number(),
    output_cost: z.number(),
    billable: z.boolean(),
    integration_id: z.nullable(z.string()),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "total_cost": "totalCost",
        "input_cost": "inputCost",
        "output_cost": "outputCost",
        "integration_id": "integrationId",
    });
});
function billingFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Billing$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Billing' from JSON`);
}
/** @internal */
exports.AgentInactiveStreamingEventData$inboundSchema = z.object({
    last_message: z.string(),
    last_message_full: z.lazy(() => exports.LastMessageFull$inboundSchema).optional(),
    finish_reason: exports.AgentInactiveStreamingEventFinishReason$inboundSchema,
    pending_tool_calls: z.array(z.lazy(() => exports.AgentInactiveStreamingEventPendingToolCalls$inboundSchema)).optional(),
    usage: z.lazy(() => exports.AgentInactiveStreamingEventUsage$inboundSchema)
        .optional(),
    billing: z.lazy(() => exports.Billing$inboundSchema).optional(),
    workflowRunId: z.string(),
    responseId: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "last_message": "lastMessage",
        "last_message_full": "lastMessageFull",
        "finish_reason": "finishReason",
        "pending_tool_calls": "pendingToolCalls",
    });
});
function agentInactiveStreamingEventDataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentInactiveStreamingEventData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentInactiveStreamingEventData' from JSON`);
}
/** @internal */
exports.AgentInactiveStreamingEvent$inboundSchema = z.object({
    type: z.literal("event.agents.inactive"),
    timestamp: z.string(),
    data: z.lazy(() => exports.AgentInactiveStreamingEventData$inboundSchema),
});
function agentInactiveStreamingEventFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgentInactiveStreamingEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgentInactiveStreamingEvent' from JSON`);
}
//# sourceMappingURL=agentinactivestreamingevent.js.map