"use client"
import { Button } from "@/app/_components/ui/button"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/app/_components/ui/tooltip"
import {
    Clock,
    AlertTriangle,
    Users,
    Building,
    Skull,
} from "lucide-react"
import { Overlay } from "../overlay"
import { ControlPosition } from "mapbox-gl"
import { IconBriefcaseOff, IconCategory, IconCategoryFilled } from "@tabler/icons-react"

interface MapMenusProps {
    onControlChange: (control: string) => void
    activeControl: string
    position: ControlPosition
}

export default function MapMenus({ onControlChange, activeControl, position = "top-left" }: MapMenusProps) {
    const menus = [
        { id: "crime-rate", icon: <Skull size={20} />, label: "Crime Rate" },
        { id: "population", icon: <Users size={20} />, label: "Population" },
        { id: "unemployment", icon: <IconBriefcaseOff size={20} />, label: "Unemployment" },
        { id: "alerts", icon: <AlertTriangle size={20} className="text-amber-500" />, label: "Alerts" },
        { id: "time", icon: <Clock size={20} />, label: "Time Analysis" },
        { id: "unit", icon: <Building size={20} />, label: "Unit" },
        { id: "category", icon: <IconCategory size={20} />, label: "Category" },
    ]

    return (

        <div className="absolute top-0 left-0 z-10 bg-black/75 rounded-md m-2 p-1 flex items-center space-x-1">
            <TooltipProvider>
                {menus.map((control) => (
                    <Tooltip key={control.id}>
                        <TooltipTrigger asChild>
                            <Button
                                variant={activeControl === control.id ? "default" : "ghost"}
                                size="icon"
                                className={`h-8 w-8 rounded-md ${activeControl === control.id
                                    ? "bg-white text-black hover:bg-white/90"
                                    : "text-white hover:bg-white/10"
                                    }`}
                                onClick={() => onControlChange(control.id)}
                            >
                                {control.icon}
                                <span className="sr-only">{control.label}</span>
                            </Button>
                        </TooltipTrigger>
                        <TooltipContent side="bottom">
                            <p>{control.label}</p>
                        </TooltipContent>
                    </Tooltip>
                ))}
            </TooltipProvider>
        </div>

    )
}
