"use client"

import { useSession, signOut } from "next-auth/react"
import { useRouter } from "next/navigation"
import { useEffect } from "react"
import { Button } from "@/components/ui/button"

export default function AdminDashboardPage() {
    const { data: session, status } = useSession()
    const router = useRouter()

    useEffect(() => {
        if (status === "unauthenticated") {
            router.push("/auth/login?callbackUrl=/admin")
        }
    }, [status, router])

    if (status === "loading") {
        return <div className="flex h-screen items-center justify-center">Yükleniyor...</div>
    }

    return (
        <div>
            <div className="flex items-center justify-between mb-8">
                <h1 className="text-3xl font-bold">Yönetici Paneli</h1>
                <div className="flex items-center gap-4">
                    <span>Merhaba, {session?.user?.name || session?.user?.email}</span>
                    <Button variant="outline" onClick={() => signOut({ callbackUrl: "/auth/login" })}>
                        Çıkış Yap
                    </Button>
                </div>
            </div>

            <div className="grid grid-cols-1 md:grid-cols-3 gap-6">
                <div className="p-6 bg-white rounded-lg shadow dark:bg-gray-800">
                    <h3 className="text-lg font-semibold mb-2">Toplam Kullanıcı</h3>
                    <p className="text-3xl font-bold">0</p>
                </div>
                <div className="p-6 bg-white rounded-lg shadow dark:bg-gray-800">
                    <h3 className="text-lg font-semibold mb-2">Toplam Satış</h3>
                    <p className="text-3xl font-bold">₺0.00</p>
                </div>
                <div className="p-6 bg-white rounded-lg shadow dark:bg-gray-800">
                    <h3 className="text-lg font-semibold mb-2">Aktif Siparişler</h3>
                    <p className="text-3xl font-bold">0</p>
                </div>
            </div>
        </div>
    )
}
