import { formatDateEST } from "@/lib/timezoneUtils";
import { Badge } from "@/components/ui/badge";

export default function LegalMattersSection({ data }: { data: any[] }) {
  return (
    <div className="space-y-4">
      <h2 className="text-xl font-bold text-foreground border-b pb-2">Legal Matters</h2>
      <div className="space-y-3">
        {data.map((item) => (
          <div key={item.id} className="p-4 bg-muted/30 rounded-lg border">
            <div className="flex items-start justify-between">
              <div>
                <p className="font-semibold text-foreground">{item.title}</p>
                <p className="text-xs text-muted-foreground mt-1">
                  {item.opened_date ? formatDateEST(item.opened_date) : "-"}
                  {item.attorney && ` · ${item.attorney}`}
                  {item.case_number && ` · #${item.case_number}`}
                </p>
              </div>
              <Badge variant="outline">{item.status}</Badge>
            </div>
            {item.description && <p className="text-sm text-muted-foreground mt-2">{item.description}</p>}
          </div>
        ))}
      </div>
    </div>
  );
}
