import { DiagnosticEntry } from '../models/diagnostics.model';

export function calculateHealthScore(entries: DiagnosticEntry[]): number {
  const penalties = entries.reduce((acc, entry) => {
    if (entry.severity === 'critical') return acc + 15;
    if (entry.severity === 'error') return acc + 8;
    if (entry.severity === 'warning') return acc + 3;
    return acc;
  }, 0);

  return Math.max(0, 100 - penalties);
}
