// src/app/(admin)/layout.tsx
import { useAuth } from "@/hooks/useAuth";
// import { SideNav } from '@/components/layout/SideNav';
import { AdminSidebar } from "@/components/admin/AdminSidebar";
import { TopNav } from "@/components/layout/TopNav";

export default function AdminLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const { user } = useAuth();
  const isAdmin =
    user?.role === "super_admin" || user?.role === "company_admin";

  if (!isAdmin) {
    return <div>접근 권한이 없습니다.</div>;
  }

  return (
    <div className="min-h-screen flex">
      <AdminSidebar />
      <div className="flex-1">
        <TopNav />
        <main className="p-6">{children}</main>
      </div>
    </div>
  );
}
