import { AlertCircle, CheckCircle2, XCircle, Clock } from 'lucide-react';

interface ModerationStatsProps {
    stats: any;
    loading: boolean;
}

export function ModerationStats({ stats, loading }: ModerationStatsProps) {
    if (loading || !stats) {
        return (
            <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 animate-pulse">
                {[1, 2, 3, 4].map((i) => (
                    <div key={i} className="bg-white rounded-xl shadow-sm border border-slate-200 p-6 h-32"></div>
                ))}
            </div>
        );
    }

    // Determine urgency color for Pending
    let pendingColor = "text-green-600 bg-green-50";
    if (stats.pending > 10) pendingColor = "text-yellow-600 bg-yellow-50";
    if (stats.pending > 25) pendingColor = "text-orange-600 bg-orange-50";

    return (
        <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
            {/* Card 1: Pending Jobs */}
            <div className={`rounded-xl shadow-sm border border-slate-200 p-6 relative overflow-hidden transition-colors ${pendingColor}`}>
                <div className="flex justify-between items-start">
                    <div>
                        <p className="text-sm font-medium text-slate-600 mb-1">Awaiting Review</p>
                        <h3 className="text-3xl font-bold">{stats.pending}</h3>
                    </div>
                    <div className="p-3 bg-white/60 rounded-lg">
                        <AlertCircle className="w-6 h-6" />
                    </div>
                </div>
                <div className="mt-4 flex items-center gap-4 text-sm font-medium opacity-80">
                    <span className="text-red-700">{stats.urgent} urgent (&gt;24h)</span>
                    <span>{stats.recent} recent</span>
                </div>
            </div>

            {/* Card 2: Approved Today */}
            <div className="bg-white rounded-xl shadow-sm border border-slate-200 p-6">
                <div className="flex justify-between items-start">
                    <div>
                        <p className="text-sm font-medium text-slate-500 mb-1">Jobs Approved</p>
                        <h3 className="text-3xl font-bold text-slate-900">{stats.approvedToday}</h3>
                    </div>
                    <div className="p-3 bg-green-50 text-green-600 rounded-lg">
                        <CheckCircle2 className="w-6 h-6" />
                    </div>
                </div>
                <div className="mt-4 text-sm font-medium text-slate-500">
                    Approved Today
                </div>
            </div>

            {/* Card 3: Rejected Today */}
            <div className="bg-white rounded-xl shadow-sm border border-slate-200 p-6">
                <div className="flex justify-between items-start">
                    <div>
                        <p className="text-sm font-medium text-slate-500 mb-1">Jobs Rejected</p>
                        <h3 className="text-3xl font-bold text-slate-900">{stats.rejectedToday}</h3>
                    </div>
                    <div className="p-3 bg-red-50 text-red-600 rounded-lg">
                        <XCircle className="w-6 h-6" />
                    </div>
                </div>
                <div className="mt-4 text-sm font-medium text-slate-500">
                    Rejected Today
                </div>
            </div>

            {/* Card 4: Average Review Time */}
            <div className="bg-white rounded-xl shadow-sm border border-slate-200 p-6">
                <div className="flex justify-between items-start">
                    <div>
                        <p className="text-sm font-medium text-slate-500 mb-1">Avg. Time Per Job</p>
                        <h3 className="text-3xl font-bold text-slate-900">{stats.averageReviewTimeMinutes}m</h3>
                    </div>
                    <div className="p-3 bg-blue-50 text-blue-600 rounded-lg">
                        <Clock className="w-6 h-6" />
                    </div>
                </div>
                <div className="mt-4 text-sm font-medium text-slate-500 flex items-center gap-1">
                    <span className="text-green-600">Target: &lt; 20 minutes</span>
                </div>
            </div>
        </div>
    );
}
