import { Link } from '@inertiajs/react';
import {
    ChefHat,
    ClipboardList,
    LayoutGrid,
    Martini,
    ShoppingBag,
    Utensils,
    Wallet,
} from 'lucide-react';
import AppLogo from '@/components/app-logo';
import { NavMain } from '@/components/nav-main';
import { NavUser } from '@/components/nav-user';
import {
    Sidebar,
    SidebarContent,
    SidebarFooter,
    SidebarHeader,
    SidebarMenu,
    SidebarMenuButton,
    SidebarMenuItem,
} from '@/components/ui/sidebar';
import BarController from '@/actions/App/Http/Controllers/BarController';
import CashierController from '@/actions/App/Http/Controllers/CashierController';
import KitchenController from '@/actions/App/Http/Controllers/KitchenController';
import OrderController from '@/actions/App/Http/Controllers/OrderController';
import ProductController from '@/actions/App/Http/Controllers/ProductController';
import TableController from '@/actions/App/Http/Controllers/TableController';
import { dashboard } from '@/routes';
import type { NavItem } from '@/types';

const mainNavItems: NavItem[] = [
    {
        title: 'Tableau de bord',
        href: dashboard(),
        icon: LayoutGrid,
    },
    {
        title: 'Produits',
        href: ProductController.index(),
        icon: ShoppingBag,
    },
    {
        title: 'Tables',
        href: TableController.index(),
        icon: Utensils,
    },
    {
        title: 'Commandes',
        href: OrderController.index(),
        icon: ClipboardList,
    },
    {
        title: 'Cuisine',
        href: KitchenController.index(),
        icon: ChefHat,
    },
    {
        title: 'Bar',
        href: BarController.index(),
        icon: Martini,
    },
    {
        title: 'Caisse',
        href: CashierController.index(),
        icon: Wallet,
    },
];

export function AppSidebar() {
    return (
        <Sidebar collapsible="icon" variant="inset">
            <SidebarHeader>
                <SidebarMenu>
                    <SidebarMenuItem>
                        <SidebarMenuButton size="lg" asChild>
                            <Link href={dashboard()} prefetch>
                                <AppLogo />
                            </Link>
                        </SidebarMenuButton>
                    </SidebarMenuItem>
                </SidebarMenu>
            </SidebarHeader>

            <SidebarContent>
                <NavMain items={mainNavItems} />
            </SidebarContent>

            <SidebarFooter>
                <NavUser />
            </SidebarFooter>
        </Sidebar>
    );
}
