import { Sidebar } from "@/components/sidebar";
import { auth } from "@/auth";
import { redirect } from "next/navigation";
import {
    LayoutDashboard,
    UserCheck,
    BookOpen,
    PieChart,
    BarChart3,
} from "lucide-react";

export default async function AdminLayout({
    children,
}: {
    children: React.ReactNode;
}) {
    const session = await auth();

    if (!session?.user) {
        redirect("/login");
    }

    // Double check role
    // if (session.user.role !== 'ADMIN') {
    //   redirect('/me/dashboard');
    // }

    return (
        <div className="flex h-screen bg-neutral-50 dark:bg-neutral-950">
            <Sidebar
                portal="admin"
                user={{
                    name: session.user.name,
                    email: session.user.email,
                    role: "Administrator"
                }}
            />
            <main className="flex-1 overflow-y-auto p-8 relative">
                <div className="max-w-7xl mx-auto space-y-8">
                    {children}
                </div>

                {/* Background Accents */}
                <div className="fixed top-[-5%] right-[-5%] w-[30%] h-[30%] bg-emerald-500/5 blur-[100px] -z-10 rounded-full" />
                <div className="fixed bottom-[-5%] left-[20%] w-[30%] h-[30%] bg-blue-500/5 blur-[100px] -z-10 rounded-full" />
            </main>
        </div>
    );
}
