"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecuteUploadFileToolDefinition = exports.executeUploadFileClientResponseSchema = exports.executeUploadFileServerResultSchema = exports.executeUploadFileArgumentsSchema = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
var agentToolNames_js_1 = require("../shared/agentToolNames.js");
var constants_js_1 = require("../shared/constants.js");
var customFind_js_1 = require("../shared/customFind.js");
exports.executeUploadFileArgumentsSchema = zod_1.z.object({
    elementDescription: zod_1.z.string().describe(constants_js_1.TOOL_ELEMENT_DESCRIPTION_INSTRUCTIONS),
    file_name: zod_1.z
        .string()
        .describe('The exact name of the file to upload, as it appears in the mabl workspace file uploads. The tool will fail if no upload with this exact name is found.'),
    customFind: customFind_js_1.customFindSchema.optional(),
});
exports.executeUploadFileServerResultSchema = zod_1.z.object({
    elementDescription: zod_1.z.string(),
    elementBoundingBox: zod_1.z
        .object({
        top: zod_1.z.number(),
        left: zod_1.z.number(),
        bottom: zod_1.z.number(),
        right: zod_1.z.number(),
    })
        .optional(),
    elementTargetPoint: zod_1.z
        .object({
        x: zod_1.z.number(),
        y: zod_1.z.number(),
    })
        .optional(),
    files: zod_1.z.array(zod_1.z.object({
        id: zod_1.z.string().optional(),
        name: zod_1.z.string().optional(),
        size: zod_1.z.number().optional(),
        type: zod_1.z.string().optional(),
        url: zod_1.z.string().optional(),
    })),
});
exports.executeUploadFileClientResponseSchema = zod_1.z.object({
    success: zod_1.z.boolean(),
    message: zod_1.z.string().optional(),
    new_screenshot: zod_1.z.string().optional().meta({
        description: 'Base64-encoded PNG screenshot of the page after the upload action',
    }),
    current_url: zod_1.z.string().optional().meta({
        description: 'The current URL after the upload action',
    }),
});
exports.ExecuteUploadFileToolDefinition = (0, toolDefinition_js_1.defineTool)({
    name: agentToolNames_js_1.AgentToolNames.ExecuteUploadFile,
    description: 'Uploads a file using a file input element on the page. The elementDescription identifies the file input element. The file_name must exactly match the name of a previously uploaded file in the mabl workspace. Records both the set_files step and the await_upload step.',
    argumentsSchema: exports.executeUploadFileArgumentsSchema,
    serverPrepareResultSchema: exports.executeUploadFileServerResultSchema,
    responseSchema: exports.executeUploadFileClientResponseSchema,
});
//# sourceMappingURL=ExecuteUploadFileDefinition.js.map