import { ClipboardList, Wrench, AlertTriangle, CheckCircle2 } from "lucide-react";
import { Card, CardContent } from "@/components/ui/card";

interface ResidenceSummaryProps {
  totalTasks: number;
  inProgress: number;
  overdue: number;
  completed: number;
}

interface StatCardProps {
  icon: React.ElementType;
  label: string;
  value: number;
  accent?: string;
}

function StatCard({ icon: Icon, label, value, accent }: StatCardProps) {
  return (
    <Card>
      <CardContent className="flex items-center gap-4">
        <div className="rounded-full bg-muted p-2.5">
          <Icon className={`size-5 ${accent ?? "text-muted-foreground"}`} />
        </div>
        <div>
          <p className="text-2xl font-bold">{value}</p>
          <p className="text-sm text-muted-foreground">{label}</p>
        </div>
      </CardContent>
    </Card>
  );
}

export function ResidenceSummary({ totalTasks, inProgress, overdue, completed }: ResidenceSummaryProps) {
  return (
    <div className="grid grid-cols-2 gap-4 sm:grid-cols-4">
      <StatCard icon={ClipboardList} label="Total Tasks" value={totalTasks} />
      <StatCard icon={Wrench} label="In Progress" value={inProgress} accent="text-[#C4856A]" />
      <StatCard icon={AlertTriangle} label="Overdue" value={overdue} accent={overdue > 0 ? "text-red-500" : "text-muted-foreground"} />
      <StatCard icon={CheckCircle2} label="Completed" value={completed} accent="text-primary" />
    </div>
  );
}
