/**
 * Calculates a safety score from 0–100 given a list of crash risks.
 * Penalties: CRITICAL=-15 (cap 60), HIGH=-5 (cap 30), MEDIUM=-1 (cap 10).
 * Score cannot go below 0.
 */
export function calculateScore(risks) {
    const criticalCount = risks.filter((r) => r.severity === 'CRITICAL').length;
    const highCount = risks.filter((r) => r.severity === 'HIGH').length;
    const mediumCount = risks.filter((r) => r.severity === 'MEDIUM').length;
    const criticalPenalty = Math.min(criticalCount * 15, 60);
    const highPenalty = Math.min(highCount * 5, 30);
    const mediumPenalty = Math.min(mediumCount * 1, 10);
    return Math.max(0, 100 - criticalPenalty - highPenalty - mediumPenalty);
}
//# sourceMappingURL=score-calculator.js.map