"use strict";
/**
 * 🔍 Check Command - Merged audit + validate functionality
 * Comprehensive .faf file validation and freshness checking
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkCommand = checkCommand;
const validate_1 = require("./validate");
const audit_1 = require("./audit");
const championship_style_1 = require("../utils/championship-style");
/**
 * Comprehensive check command - combines validation and audit
 */
async function checkCommand(options = {}) {
    try {
        const startTime = Date.now();
        console.log(championship_style_1.FAF_COLORS.fafCyan(`${championship_style_1.FAF_ICONS.magnifying_glass} Comprehensive .faf Check`));
        // If no specific options, do both format and freshness checks
        const checkFormat = options.format || (!options.fresh && !options.format);
        const checkFreshness = options.fresh || (!options.fresh && !options.format);
        let hasErrors = false;
        if (checkFormat) {
            console.log(`${championship_style_1.FAF_COLORS.fafCyan('├─ ')}Checking format and validity...`);
            try {
                // Call validate with proper parameters
                await (0, validate_1.validateFafFile)(undefined, {
                    verbose: options.detailed
                });
            }
            catch {
                hasErrors = true;
            }
        }
        if (checkFreshness) {
            console.log(`${championship_style_1.FAF_COLORS.fafCyan('├─ ')}Checking freshness and completeness...`);
            try {
                // Call audit with proper parameters
                await (0, audit_1.auditFafFile)(undefined, {
                // AuditOptions doesn't have detailed, use defaults
                });
            }
            catch {
                hasErrors = true;
            }
        }
        const duration = Date.now() - startTime;
        if (!hasErrors) {
            console.log();
            console.log(championship_style_1.FAF_COLORS.fafGreen(`${championship_style_1.FAF_ICONS.trophy} All checks passed in ${duration}ms!`));
            console.log(`${championship_style_1.FAF_COLORS.fafCyan(`${championship_style_1.FAF_ICONS.magic_wand} Try: `)}faf score${championship_style_1.FAF_COLORS.fafCyan(' - See your completeness score')}`);
        }
    }
    catch (error) {
        console.error(championship_style_1.FAF_COLORS.fafOrange(`${championship_style_1.FAF_ICONS.shield} Check failed: ${error instanceof Error ? error.message : String(error)}`));
        process.exit(1);
    }
}
//# sourceMappingURL=check.js.map