"use strict";
/**
 * Health Routes - System health checks and fixes
 */
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = require("express");
const health_service_1 = require("../health-service");
const router = (0, express_1.Router)();
/**
 * GET /api/health - Run health checks
 */
router.get('/', async (_req, res) => {
    try {
        const report = await (0, health_service_1.runHealthChecks)();
        res.json(report);
    }
    catch (error) {
        res.status(500).json({ error: error.message });
    }
});
/**
 * POST /api/health/fix/:checkId - Fix a health issue
 */
router.post('/fix/:checkId', (req, res) => {
    try {
        const { checkId } = req.params;
        const result = (0, health_service_1.fixHealthIssue)(checkId);
        if (result.success) {
            res.json({ success: true, message: result.message });
        }
        else {
            res.status(400).json({ success: false, message: result.message });
        }
    }
    catch (error) {
        res.status(500).json({ error: error.message });
    }
});
exports.default = router;
//# sourceMappingURL=health-routes.js.map