import type { AnalysisResult } from "@/lib/analysis";
import { LEVEL_LABEL, LEVEL_CLASS } from "@/lib/priority-ui";

export function BilanDetailView({ analysis }: { analysis: AnalysisResult }) {
  if (analysis.topPriorities.length === 0) {
    return <p className="text-sm text-slate-400">Aucune priorité majeure détectée pour ce patient.</p>;
  }

  return (
    <div className="grid gap-4">
      {analysis.topPriorities.map((p, i) => (
        <div key={i} className="bg-white border border-slate-200 rounded-xl p-4">
          <span className={`inline-block text-xs font-bold rounded-full px-2.5 py-1 mb-2 ${LEVEL_CLASS[p.level]}`}>
            {LEVEL_LABEL[p.level]}
          </span>
          <h3 className="font-bold mb-2">{p.theme}</h3>
          <p className="text-sm mb-1">
            <strong>Constat :</strong> {p.priority}
          </p>
          <p className="text-sm mb-1">
            <strong>Frein probable :</strong> {p.frein}
          </p>
          <p className="text-sm mb-1">
            <strong>Conseil :</strong> {p.conseil}
          </p>
          <p className="text-sm mb-1">
            <strong>Ressources :</strong> {p.ressource}
          </p>
          <p className="text-sm">
            <strong>Suivi :</strong> {p.suivi}
          </p>
        </div>
      ))}
    </div>
  );
}
