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

export default function CollectionsSection({ data }: { data: any[] }) {
  return (
    <div className="space-y-4">
      <h2 className="text-xl font-bold text-foreground border-b pb-2">Collections</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.owners ? `${item.owners.first_name} ${item.owners.last_name}` : "Unknown"}
                </p>
                <p className="text-xs text-muted-foreground mt-1">
                  Amount: ${Number(item.amount_owed || 0).toFixed(2)}
                </p>
              </div>
              <Badge variant="outline">{item.status}</Badge>
            </div>
            {item.notes && (
              <p className="text-sm text-muted-foreground mt-2">{item.notes}</p>
            )}
          </div>
        ))}
      </div>
    </div>
  );
}
