"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecuteWaitUntilToolDefinition = exports.executeWaitUntilResponseSchema = exports.executeWaitUntilServerResultSchema = exports.executeWaitUntilArgumentsSchema = 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");
exports.executeWaitUntilArgumentsSchema = zod_1.z.object({
    description: zod_1.z
        .string()
        .max(100)
        .optional()
        .describe('A brief description of what this step does (max 100 characters)'),
    reasoning: zod_1.z
        .string()
        .optional()
        .describe('Brief explanation of why this action is being taken and what it aims to achieve'),
    elementDescription: zod_1.z.string().meta({ description: constants_js_1.TOOL_ELEMENT_DESCRIPTION_INSTRUCTIONS }),
    timeoutSeconds: zod_1.z.number().meta({
        description: 'Maximum number of seconds to wait for the element to appear. Use a value appropriate for the expected load time (e.g. 10–30 seconds).',
    }),
});
exports.executeWaitUntilServerResultSchema = zod_1.z.object({
    elementDescription: zod_1.z.string(),
    timeoutSeconds: zod_1.z.number(),
    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(),
    }),
    elementTargetPoint: zod_1.z.object({
        x: zod_1.z.number(),
        y: zod_1.z.number(),
    }),
});
exports.executeWaitUntilResponseSchema = zod_1.z.object({
    success: zod_1.z.boolean(),
    message: zod_1.z.string().optional(),
});
exports.ExecuteWaitUntilToolDefinition = (0, toolDefinition_js_1.defineTool)({
    name: agentToolNames_js_1.AgentToolNames.ExecuteWaitUntil,
    description: 'Records a wait-until step that pauses test execution until the specified element is present on the page. Use this when the test will need to wait for a specific element to become visible or other visual change to the page. The step will be saved as part of the test.',
    argumentsSchema: exports.executeWaitUntilArgumentsSchema,
    serverPrepareResultSchema: exports.executeWaitUntilServerResultSchema,
    responseSchema: exports.executeWaitUntilResponseSchema,
});
//# sourceMappingURL=ExecuteWaitUntilDefinition.js.map