"use client";

import type { FindingDto } from "@/lib/api";
import { FindingRow } from "./finding-row";

interface ScanDetailProps {
  findings: FindingDto[];
  onFindingClick?: (finding: FindingDto) => void;
}

export function ScanDetail({ findings, onFindingClick }: ScanDetailProps) {
  if (findings.length === 0) {
    return (
      <div className="text-sm text-muted-foreground py-4 text-center">
        No findings in this scan.
      </div>
    );
  }

  return (
    <div className="space-y-2 mt-4">
      {findings.map((finding, index) => (
        <FindingRow
          key={`${finding.concept_path}-${finding.file}-${finding.line}-${index}`}
          finding={finding}
          onClick={() => onFindingClick?.(finding)}
        />
      ))}
    </div>
  );
}
