import { Card } from '@/components/ui/card';
import AppLayout from '@/layouts/app-layout';
import { formatToCurrency } from '@/lib/utils';
import { BreadcrumbItem } from '@/types';
import { Link } from '@inertiajs/react';
import { DollarSign, Users } from 'lucide-react';

const breadcrumbs: BreadcrumbItem[] = [
    {
        title: 'Admin Dashboard',
        href: '/dashboard',
    },
];

type AdminDashboardPageProps = {
    total_users: number;
    total_deposits: number;
    active_deposits: number;
};

export default function AdminDashboardPage({ total_users, total_deposits, active_deposits }: AdminDashboardPageProps) {
    return (
        <AppLayout breadcrumbs={breadcrumbs}>
            <div className="flex-1 px-4 py-8 md:px-6 lg:py-12">
                <div className="mb-8 grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
                    {/* Total Users Card */}
                    <Link href="/admin/users">
                        <Card className="cursor-pointer flex-row items-center gap-4 rounded-xl p-6">
                            <div className="flex h-12 w-12 items-center justify-center rounded-lg bg-blue-100 text-blue-600">
                                <Users className="h-6 w-6" />
                            </div>
                            <div>
                                <p className="text-sm text-gray-500">Total Users</p>
                                <p className="text-xl font-bold text-gray-900">{total_users.toLocaleString()}</p>
                            </div>
                        </Card>
                    </Link>

                    {/* Total Deposits Card */}
                    <Link href="/admin/deposits">
                        <Card className="cursor-pointer flex-row items-center gap-4 rounded-xl p-6">
                            <div className="flex h-12 w-12 items-center justify-center rounded-lg bg-green-100 text-green-600">
                                <DollarSign className="h-6 w-6" />
                            </div>
                            <div>
                                <p className="text-sm text-gray-500">Total Deposits</p>
                                <p className="text-xl font-bold text-gray-900">{formatToCurrency(total_deposits)}</p>
                            </div>
                        </Card>
                    </Link>

                    {/* Active Deposit Card */}
                    <Link href="/admin/deposits">
                        <Card className="flex cursor-pointer flex-row items-center gap-4 rounded-xl p-6">
                            <div className="flex h-12 w-12 items-center justify-center rounded-lg bg-yellow-100 text-yellow-600">
                                <DollarSign className="h-6 w-6" />
                            </div>
                            <div>
                                <p className="text-sm text-gray-500">Active Deposit</p>
                                <p className="text-xl font-bold text-gray-900">{formatToCurrency(active_deposits)}</p>
                            </div>
                        </Card>
                    </Link>
                </div>
            </div>
        </AppLayout>
    );
}
