import { ReactNode } from 'react';
import { SidebarProvider } from '@/components/ui/sidebar';
import { AdminSidebar } from './AdminSidebar';
import { AdminTopBar } from './AdminTopBar';

interface AdminLayoutProps {
  children: ReactNode;
  onRefresh?: () => void;
  refreshMode?: 'auto' | 'manual';
  pollInterval?: number;
  lastUpdated?: Date;
  isRefreshing?: boolean;
}

export function AdminLayout({ 
  children, 
  onRefresh,
  refreshMode,
  pollInterval,
  lastUpdated,
  isRefreshing
}: AdminLayoutProps) {
  return (
    <SidebarProvider defaultOpen={true}>
      <div className="flex min-h-screen w-full">
        <AdminSidebar />
        <main className="flex-1 flex flex-col overflow-hidden">
          <AdminTopBar 
            onRefresh={onRefresh}
            refreshMode={refreshMode}
            pollInterval={pollInterval}
            lastUpdated={lastUpdated}
            isRefreshing={isRefreshing}
          />
          <div className="flex-1 overflow-auto bg-muted/30">
            <div className="container mx-auto px-6 py-8 max-w-7xl">
              {children}
            </div>
          </div>
        </main>
      </div>
    </SidebarProvider>
  );
}
