"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.doTeam = doTeam;
const utils_1 = require("../utils");
const project = (0, utils_1.getProjectName)();
function doTeam(args) {
    (0, utils_1.printHeader)('Cell Team');
    const sub = args[1] || 'dashboard';
    if (sub === 'dashboard') {
        (0, utils_1.httpGet)(`/team/dashboard?project=${project}`).then((result) => {
            if (result.silos) {
                console.log(utils_1.C.bold('  Knowledge Silos:'));
                console.log(`    Count: ${result.silos.count}`);
                console.log(`    High risk: ${result.silos.high}`);
            }
            if (result.busFactor) {
                console.log(utils_1.C.bold('  Bus Factor:'));
                console.log(`    Score: ${result.busFactor.score || 'N/A'}`);
            }
            if (result.health) {
                console.log(utils_1.C.bold('  Team Health:'));
                console.log(`    Score: ${result.health.score || 'N/A'}`);
            }
        }).catch(() => (0, utils_1.printWarning)('Failed to get team dashboard'));
        return;
    }
    if (sub === 'health') {
        (0, utils_1.httpGet)(`/team/health?project=${project}`).then((result) => {
            console.log(JSON.stringify(result, null, 2));
        }).catch(() => (0, utils_1.printWarning)('Failed to get team health'));
        return;
    }
    if (sub === 'silos') {
        (0, utils_1.httpGet)('/team/silos').then((result) => {
            if (result.silos && result.silos.length > 0) {
                for (const s of result.silos) {
                    console.log(`  ${s.name}: ${s.riskLevel} risk`);
                }
            }
            else {
                (0, utils_1.printDim)('No knowledge silos detected');
            }
        }).catch(() => (0, utils_1.printWarning)('Failed to get silos'));
        return;
    }
    if (sub === 'retro') {
        const days = parseInt(args[2] || '14');
        (0, utils_1.httpGet)(`/team/retro?days=${days}&project=${project}`).then((result) => {
            console.log(JSON.stringify(result, null, 2));
        }).catch(() => (0, utils_1.printWarning)('Failed to get retro'));
        return;
    }
    // Default: show dashboard
    (0, utils_1.httpGet)(`/team/dashboard?project=${project}`).then((result) => {
        console.log(JSON.stringify(result, null, 2));
    }).catch(() => (0, utils_1.printWarning)('Failed to get team info'));
}
//# sourceMappingURL=team.js.map