// app/admin/layout.js
'use client'
import { useState } from "react";
import RequireAuth from "@/components/RequireAuth"
import Sidebar from '@/components/Dashboard/common/Sidebar';
import Navbar from '@/components/Dashboard/common/Navbar';

export default function AdminLayout({ children }) {
    const [sidebarOpen, setSidebarOpen] = useState(false);
    return (
        <RequireAuth requiredRole="admin">
            <div className="flex h-screen bg-gray-50">
                <Sidebar sidebarOpen={sidebarOpen} setSidebarOpen={setSidebarOpen} role="admin" />
                <div className="flex flex-col flex-1 overflow-hidden">
                    <Navbar setSidebarOpen={setSidebarOpen} role="admin" />
                    <main className="flex-1 overflow-y-auto p-6">
                        {children}
                    </main>
                </div>
            </div>
        </RequireAuth>
    )
}