import Link from "next/link";
import { verifySession } from "@/lib/dal";
import { LogoutButton } from "@/components/logout-button";

const LINKS = [
  { href: "/admin/bookings", label: "Bookings" },
  { href: "/admin/services", label: "Services" },
  { href: "/admin/gallery", label: "Gallery" },
  { href: "/admin/settings", label: "Settings" },
];

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

  return (
    <div className="flex min-h-screen bg-cream">
      <aside className="w-56 shrink-0 border-r border-blush-dark/60 bg-blush/60 p-6">
        <p className="font-display text-lg text-rosewood">Hair by Nyasia</p>
        <p className="mt-1 text-xs text-ink/50">{session.email}</p>
        <nav className="mt-8 space-y-1">
          {LINKS.map((link) => (
            <Link
              key={link.href}
              href={link.href}
              className="block rounded-lg px-3 py-2 text-sm text-ink/70 transition hover:bg-cream hover:text-rosewood"
            >
              {link.label}
            </Link>
          ))}
        </nav>
        <div className="mt-8">
          <LogoutButton />
        </div>
      </aside>
      <main className="flex-1 p-10">{children}</main>
    </div>
  );
}
