"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.waitStepSchema = exports.accessibilityCheckStepSchema = exports.setViewportStepSchema = exports.clearCookiesStepSchema = exports.removeCookieStepSchema = exports.setCookieStepSchema = void 0;
const zod_1 = require("zod");
const common_1 = require("../common");
const find_descriptors_1 = require("../find-descriptors");
const setCookieOptionsSchema = zod_1.z
    .object({
    domain: zod_1.z.string().optional(),
    expires: zod_1.z.number().optional(),
    httpOnly: zod_1.z.boolean().optional(),
    path: zod_1.z.string().optional(),
    sameSite: zod_1.z.enum(['Strict', 'Lax', 'None']).optional(),
    secure: zod_1.z.boolean().optional(),
    url: zod_1.z.string().optional(),
})
    .passthrough();
exports.setCookieStepSchema = common_1.baseStepDescriptorSchema
    .extend({
    name: zod_1.z.string(),
    value: zod_1.z.string(),
    options: setCookieOptionsSchema.optional(),
})
    .passthrough()
    .describe('Set a browser cookie with a name and value');
exports.removeCookieStepSchema = common_1.baseStepDescriptorSchema
    .extend({
    name: zod_1.z.string(),
})
    .passthrough()
    .describe('Remove a browser cookie by name');
exports.clearCookiesStepSchema = common_1.baseStepDescriptorSchema
    .passthrough()
    .describe('Clear all browser cookies');
exports.setViewportStepSchema = common_1.baseStepDescriptorSchema
    .extend({
    size: zod_1.z.object({
        height: zod_1.z.number().optional(),
        width: zod_1.z.number().optional(),
    }),
})
    .passthrough()
    .describe('Set the browser viewport dimensions');
const accessibilitySeverityEnum = zod_1.z.enum([
    'critical',
    'minor',
    'moderate',
    'serious',
]);
exports.accessibilityCheckStepSchema = common_1.baseStepDescriptorSchema
    .extend({
    tags: zod_1.z
        .array(zod_1.z.string())
        .optional()
        .describe("axe-core rule tags to include (e.g., 'wcag2a', 'wcag2aa')"),
    rules: zod_1.z.array(zod_1.z.string()).optional(),
    disabledRules: zod_1.z
        .array(zod_1.z.string())
        .optional()
        .describe('axe-core rule IDs to skip'),
    failOn: zod_1.z
        .object({
        severity: accessibilitySeverityEnum,
    })
        .optional()
        .describe('Minimum severity level that causes the step to fail'),
    runInMainFrame: zod_1.z.boolean().optional(),
    bypassCors: zod_1.z.boolean().optional(),
    disabledRulesOnIframes: zod_1.z.array(zod_1.z.string()).optional(),
    find: zod_1.z
        .union([find_descriptors_1.findElementDescriptorSchema, find_descriptors_1.findCustomDescriptorSchema])
        .optional(),
})
    .passthrough()
    .describe('Run an axe-core accessibility scan on the page or element');
exports.waitStepSchema = common_1.baseStepDescriptorSchema
    .extend({
    milliseconds: zod_1.z.number().describe('Duration to wait in milliseconds'),
})
    .passthrough()
    .describe('Pause test execution for a specified duration');
