import { Link } from '@inertiajs/react';
import {
    Sparkles, Home, Hash, LayoutDashboard, FileText, Target,
    Users, Database, LifeBuoy, BookOpen,
} from 'lucide-react';
import AppLogo from '@/components/app-logo';
import { NavFooter } from '@/components/nav-footer';
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';
import type { NavItem } from '@/types';

// DataSBJC primary navigation — mirrors the reference sidebar.
const mainNavItems: NavItem[] = [
    { title: 'AI Analyst', href: '/ai', icon: Sparkles },
    { title: 'Home', href: dashboard(), icon: Home },
    { title: 'Metrics', href: '/metrics', icon: Hash },
    { title: 'Dashboards', href: '/dashboards', icon: LayoutDashboard },
    { title: 'Reports', href: '/reports', icon: FileText },
    { title: 'Goals & OKRs', href: '/goals', icon: Target },
    { title: 'Spaces', href: '/spaces', icon: Users },
    { title: 'Data Manager', href: '/data-manager', icon: Database },
];

const footerNavItems: NavItem[] = [
    { title: 'Help & Support', href: '/support', icon: LifeBuoy },
    { title: 'Documentation', href: '/docs', icon: BookOpen },
];

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>
                <NavFooter items={footerNavItems} className="mt-auto" />
                <NavUser />
            </SidebarFooter>
        </Sidebar>
    );
}
