import { type EvaluationRunEvent } from "@/hooks/useRoundEvaluationRun";

type EvaluationEventsListProps = {
  events: EvaluationRunEvent[];
  formatEventTime: (value?: string | null) => string | null;
};

export default function EvaluationEventsList({
  events,
  formatEventTime,
}: EvaluationEventsListProps) {
  if (events.length === 0) return null;

  return (
    <div className="text-sm text-foreground-700">
      <div className="font-semibold mb-1">Poslední události</div>
      <div className="space-y-1">
        {events.map((event) => (
          <div key={event.id} className="flex flex-col">
            <span>
              [{event.level}] {event.message}
            </span>
            <span className="text-xs text-foreground-500">
              {formatEventTime(event.created_at) ?? "—"}
              {event.context?.step ? ` • krok: ${String(event.context.step)}` : ""}
            </span>
          </div>
        ))}
      </div>
    </div>
  );
}
