'use client';

import { Header } from '@/components/layout/Header';
import { Sidebar } from '@/components/layout/Sidebar';
import { useUIStore } from '@/stores/ui-store';
import { AuthGuard } from '@/components/providers/AuthGuard';

export default function DashboardLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const sidebarOpen = useUIStore((state) => state.sidebarOpen);

  return (
    <AuthGuard>
      <div className="min-h-screen">
        <Header />
        <div className="flex">
          <Sidebar />
          <main
            className={`flex-1 transition-all duration-200 ${
              sidebarOpen ? 'ml-64' : 'ml-0'
            }`}
          >
            <div className="p-6">{children}</div>
          </main>
        </div>
      </div>
    </AuthGuard>
  );
}
