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 dashboard from '@/routes/dashboard';
import dashboardcarousel from '@/routes/dashboard/carousel';
import testimonial from '@/routes/testimonial';
import { type NavItem } from '@/types';
import { Link } from '@inertiajs/react';
import {
    GalleryHorizontal,
    LayoutGrid,
    Package,
    TableOfContents,
} from 'lucide-react';
import AppLogo from './app-logo';

const mainNavItems: NavItem[] = [
    {
        title: 'Dashboard',
        href: dashboard.index(),
        icon: LayoutGrid,
    },
    {
        title: 'Home Page Slider',
        href: dashboardcarousel.index(),
        icon: GalleryHorizontal,
    },
    {
        title: 'Products',
        href: dashboard.product.index(),
        icon: Package,
    },
    {
        title: 'Testimonial',
        href: testimonial.index(),
        icon: GalleryHorizontal,
    },
    {
        title: 'FAQs',
        href: dashboard.faq.show(),
        icon: TableOfContents,
    },
];

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

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

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