"use client"

import { Button } from "@/app/_components/ui/button"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/app/_components/ui/tooltip"
import { AlertTriangle, BarChart2, Clock, Map, Shield, Users } from "lucide-react"
import { ITooltips } from "./tooltips"


// Define the primary crime data controls
const crimeTooltips = [
    { id: "incidents" as ITooltips, icon: <AlertTriangle size={20} />, label: "All Incidents" },
    { id: "heatmap" as ITooltips, icon: <Map size={20} />, label: "Crime Heatmap" },
    { id: "trends" as ITooltips, icon: <BarChart2 size={20} />, label: "Crime Trends" },
    { id: "patrol" as ITooltips, icon: <Shield size={20} />, label: "Patrol Areas" },
    { id: "clusters" as ITooltips, icon: <Users size={20} />, label: "Clusters" },
    { id: "timeline" as ITooltips, icon: <Clock size={20} />, label: "Time Analysis" },
]

interface CrimeTooltipsProps {
    activeControl?: string
    onControlChange?: (controlId: ITooltips) => void
}

export default function CrimeTooltips({ activeControl, onControlChange }: CrimeTooltipsProps) {
    return (
        <div className="z-10 bg-background rounded-md p-1 flex items-center space-x-1">
            <TooltipProvider>
                {crimeTooltips.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>
    )
}
