import type { Metadata } from "next";
import { requireUser } from "@/lib/auth";
import { AdminSidebar } from "@/components/admin/sidebar";
import { AdminTopbar } from "@/components/admin/topbar";

export const metadata: Metadata = {
  title: { default: "Yönetim", template: "%s | Yönetim Paneli" },
  robots: { index: false, follow: false },
};

export default async function ProtectedAdminLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const user = await requireUser();

  return (
    <div className="flex min-h-screen bg-[var(--navy-50)]/30">
      <AdminSidebar />
      <div className="flex-1">
        <AdminTopbar email={user.email} name={user.name} />
        <div className="px-6 py-8 md:px-10">{children}</div>
      </div>
    </div>
  );
}
