"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecuteAssertDownloadToolDefinition = exports.executeAssertDownloadResponseSchema = exports.executeAssertDownloadServerResultSchema = exports.executeAssertDownloadArgumentsSchema = exports.FILE_NAME_MATCH_MODES = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
exports.FILE_NAME_MATCH_MODES = ['equals', 'contains', 'starts_with', 'ends_with', 'matches_regex'];
exports.executeAssertDownloadArgumentsSchema = zod_1.z.object({
    description: zod_1.z.string().max(100).meta({
        description: 'A brief description of what you expect from this download (e.g., "Download the CSV report to verify column headers").',
    }),
    ai_prompt: zod_1.z.string().optional().meta({
        description: 'Natural-language assertion for AI content analysis of the downloaded file.',
    }),
    file_name: zod_1.z.string().optional().meta({
        description: 'Expected file name to assert against. If omitted, the actual downloaded file name is used with exact-match behavior.',
    }),
    file_name_match_mode: zod_1.z.enum(exports.FILE_NAME_MATCH_MODES).optional().meta({
        description: 'How to compare the downloaded file name against `file_name`: `equals` (exact, case-insensitive), `contains` (substring), `starts_with`, `ends_with`, or `matches_regex`. Defaults to `equals` when `file_name` is provided. Ignored when `file_name` is omitted.',
    }),
    file_size_bytes: zod_1.z.number().int().nonnegative().optional().meta({
        description: 'Assert the file size equals this exact value in bytes. Omit to skip the exact-size assertion.',
    }),
    file_size_bytes_min: zod_1.z.number().int().nonnegative().optional().meta({
        description: 'Assert the file size is at least this value in bytes (inclusive). Omit to skip the minimum-size assertion.',
    }),
    file_size_bytes_max: zod_1.z.number().int().nonnegative().optional().meta({
        description: 'Assert the file size is at most this value in bytes (inclusive). Omit to skip the maximum-size assertion.',
    }),
    file_mime_type: zod_1.z.string().optional().meta({
        description: 'Expected MIME type for exact match (case-insensitive). If omitted, the actual downloaded MIME type is used.',
    }),
});
/**
 * Server prepare result schema for execute_assert_download tool.
 * The server validates parameters before forwarding to the client.
 */
exports.executeAssertDownloadServerResultSchema = zod_1.z.object({});
/**
 * Response schema for execute_assert_download tool.
 */
exports.executeAssertDownloadResponseSchema = zod_1.z.object({
    success: zod_1.z.boolean(),
    message: zod_1.z.string().optional(),
});
exports.ExecuteAssertDownloadToolDefinition = (0, toolDefinition_js_1.defineTool)({
    name: 'execute_assert_download',
    description: 'Records a step that waits for a file to be downloaded and verifies it. Use after performing an action that triggers a file download (e.g., clicking an export link). Supports any file type (CSV, Excel, images, ZIP, PDF, etc.). By default the downloaded file name and MIME type are captured automatically and asserted as exact matches. Optionally override `file_name` with a match mode (`equals`, `contains`, `starts_with`, `ends_with`, `matches_regex`), override `file_mime_type`, add size assertions (`file_size_bytes`, `file_size_bytes_min`, `file_size_bytes_max`), or provide an `ai_prompt` for AI content analysis. Unlike execute_open_pdf, this tool does NOT open the file in a viewer tab.',
    argumentsSchema: exports.executeAssertDownloadArgumentsSchema,
    serverPrepareResultSchema: exports.executeAssertDownloadServerResultSchema,
    responseSchema: exports.executeAssertDownloadResponseSchema,
});
//# sourceMappingURL=ExecuteAssertDownloadDefinition.js.map