import React from 'react';
import { SidebarRail, NavItem } from './SidebarRail';
import { Database } from 'lucide-react';
import { useLanguage } from '../../contexts/LanguageContext';

interface AdminLayoutProps {
    children: React.ReactNode;
    currentView: string;
    onViewChange: (view: string) => void;
    onLogout: () => void;
    currentUser: any;
    appMode?: 'workspace' | 'admin';
    onSwitchMode?: () => void;
}

export const AdminLayout: React.FC<AdminLayoutProps> = ({
    children, currentView, onViewChange, onLogout, currentUser, appMode, onSwitchMode
}) => {
    const { t } = useLanguage();

    const navItems: NavItem[] = [
        { id: 'knowledge', icon: Database, label: t('navKnowledge') }
    ];

    return (
        <div className='flex h-screen w-full bg-slate-50 overflow-hidden relative'>
            <SidebarRail
                currentView={currentView}
                onViewChange={onViewChange}
                onLogout={onLogout}
                currentUser={currentUser}
                navItems={navItems}
                appMode={appMode}
                onSwitchMode={onSwitchMode}
            />
            <div className="flex-1 overflow-hidden relative">
                {children}
            </div>
        </div>
    );
};
