"use strict";
/**
 * Accessibility Check API Endpoint
 * Handles accessibility check requests from the UI
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = handler;
const accessibility_service_1 = require("../../../services/accessibility-service");
async function handler(req, res) {
    if (req.method !== 'POST') {
        return res.status(405).json({ error: 'Method not allowed' });
    }
    try {
        const { element, options } = req.body;
        if (!element) {
            return res.status(400).json({ error: 'Element HTML is required' });
        }
        const service = accessibility_service_1.AccessibilityService.getInstance();
        const results = await service.checkElement(element, options);
        return res.status(200).json({ results });
    }
    catch (error) {
        console.error('Accessibility check failed:', error);
        return res.status(500).json({
            error: 'Accessibility check failed',
            details: error instanceof Error ? error.message : 'Unknown error'
        });
    }
}
//# sourceMappingURL=check.js.map