const SEVERITY_PENALTY = {
    critical: 15,
    warn: 8,
    info: 2,
};
export function calculateScore(findings) {
    let score = 100;
    for (const f of findings) {
        score -= SEVERITY_PENALTY[f.severity] ?? 0;
    }
    score = Math.max(0, score);
    let grade;
    if (score >= 90) {
        grade = 'A';
    }
    else if (score >= 75) {
        grade = 'B';
    }
    else if (score >= 60) {
        grade = 'C';
    }
    else if (score >= 40) {
        grade = 'D';
    }
    else {
        grade = 'F';
    }
    return { score, grade };
}
export function pickQuickWins(findings) {
    const actionable = findings.filter((f) => f.severity === 'critical' || f.severity === 'warn');
    const severityOrder = { critical: 0, warn: 1 };
    const sorted = [...actionable].sort((a, b) => {
        const sa = severityOrder[a.severity] ?? 2;
        const sb = severityOrder[b.severity] ?? 2;
        if (sa !== sb) {
            return sa - sb;
        }
        return a.suggestion.length - b.suggestion.length;
    });
    return sorted.slice(0, 3);
}
//# sourceMappingURL=scoring.js.map