"use client"

import Link from "next/link"
import { usePathname } from "next/navigation"
import { cn } from "@/lib/utils"
import { LayoutDashboard, MessageSquare, ShieldAlert, Users, Mic2, Calendar, Music2, MapPin, UserCircle, Layers } from "lucide-react"

export default function AdminLayout({
    children,
}: {
    children: React.ReactNode
}) {
    const pathname = usePathname()

    const navItems = [
        {
            title: "Dashboard",
            href: "/admin",
            icon: LayoutDashboard
        },
        {
            title: "Artists",
            href: "/admin/artists",
            icon: Mic2
        },
        {
            title: "Musicians",
            href: "/admin/musicians",
            icon: UserCircle
        },
        {
            title: "Shows",
            href: "/admin/shows",
            icon: Calendar
        },
        {
            title: "Songs",
            href: "/admin/songs",
            icon: Music2
        },
        {
            title: "Sequences",
            href: "/admin/sequences",
            icon: Layers
        },
        {
            title: "Venues",
            href: "/admin/venues",
            icon: MapPin
        },
        {
            title: "Nicknames",
            href: "/admin/nicknames",
            icon: MessageSquare
        },
        {
            title: "Reports",
            href: "/admin/reports",
            icon: ShieldAlert
        },
        {
            title: "Users",
            href: "/admin/users",
            icon: Users
        }
    ]

    return (
        <div className="flex flex-col space-y-8 lg:flex-row lg:space-x-12 lg:space-y-0">
            <aside className="-mx-4 lg:w-1/5">
                <nav className="flex space-x-2 lg:flex-col lg:space-x-0 lg:space-y-1">
                    {navItems.map((item) => (
                        <Link
                            key={item.href}
                            href={item.href}
                        >
                            <span
                                className={cn(
                                    "group flex items-center rounded-md px-3 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground",
                                    pathname === item.href ? "bg-accent" : "transparent"
                                )}
                            >
                                <item.icon className="mr-2 h-4 w-4" />
                                <span>{item.title}</span>
                            </span>
                        </Link>
                    ))}
                </nav>
            </aside>
            <div className="flex-1 lg:max-w-4xl">{children}</div>
        </div>
    )
}
