import React from "react";
import SideNav from "@/components/moderator-side-bar/ModeratorSideBar";
import { auth } from "@/auth";
import ModeratorOnly from "@/components/moderator-only/ModeratorOnly";

export default async function ModeratorLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const session = await auth();
  if (session?.user?.role !== "MODERATOR") {
    return <ModeratorOnly />;
  }
  return (
    <>
      {/* Sidebar */}
      <SideNav />

      {/* Main Content with proper padding on larger screens */}
      <div className="min-h-screen bg-dashboardBG lg:pl-64">
        {/* Page content with space for mobile toggle */}
        <main className="p-4 pt-16 lg:p-6 lg:pt-6">{children}</main>
      </div>
    </>
  );
}
