"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuestionsListCommand = void 0;
const commander_1 = require("commander");
const chalk_1 = __importDefault(require("chalk"));
const QuestionGraphEngine_1 = require("../services/QuestionGraphEngine");
exports.QuestionsListCommand = new commander_1.Command("questions:list")
    .description("List all questions in the question graph")
    .option("--status <status>", "filter by status (unanswered, answered, skipped, outdated)")
    .option("--severity <severity>", "filter by severity (blocking, important, optional)")
    .option("--json", "output as JSON")
    .action(async (options) => {
    const engine = new QuestionGraphEngine_1.QuestionGraphEngine();
    await engine.load();
    let questions = Array.from(engine.getGraph().nodes.values());
    if (options.status) {
        questions = questions.filter((q) => q.status === options.status);
    }
    if (options.severity) {
        questions = questions.filter((q) => q.severity === options.severity);
    }
    if (options.json) {
        console.log(JSON.stringify(questions, null, 2));
        return;
    }
    if (questions.length === 0) {
        console.log(chalk_1.default.dim("\n  No questions found\n"));
        return;
    }
    console.log(chalk_1.default.bold("\n❓ Questions"));
    console.log(chalk_1.default.dim("─".repeat(60)));
    for (const q of questions) {
        const statusIcon = q.status === "answered"
            ? chalk_1.default.green("✓")
            : q.status === "skipped"
                ? chalk_1.default.dim("—")
                : q.status === "outdated"
                    ? chalk_1.default.yellow("◷")
                    : q.severity === "blocking"
                        ? chalk_1.default.red("●")
                        : chalk_1.default.dim("○");
        const severityColor = q.severity === "blocking"
            ? chalk_1.default.red
            : q.severity === "important"
                ? chalk_1.default.yellow
                : chalk_1.default.dim;
        console.log(`  ${statusIcon} ${q.text}`);
        console.log(`     ${chalk_1.default.dim("ID:")} ${chalk_1.default.cyan(q.id)} | ${severityColor(q.severity)} | ${chalk_1.default.dim(q.category)} | ${chalk_1.default.dim(q.status)}`);
        if (q.status === "answered") {
            console.log(`     ${chalk_1.default.dim("Answer:")} ${JSON.stringify(q.answer)}`);
        }
    }
    console.log(chalk_1.default.dim("─".repeat(60)));
    const counts = engine.countBySeverity();
    console.log(`  ${questions.length} total | ${counts.blocking} blocking | ${counts.important} important | ${counts.optional} optional`);
    console.log();
});
//# sourceMappingURL=questions-list.js.map