"use client";

import Link from "next/link";
import {Home, LineChart, Package, Settings, Users2, Hospital, Activity} from "lucide-react";
import {Tooltip, TooltipContent, TooltipProvider, TooltipTrigger} from "@/components/ui/tooltip";
import {
    ADMIN_ANALYTICS_URL,
    ADMIN_DASHBOARD_URL,
    ADMIN_MANAGE_CLIENT_URL,
    ADMIN_MANAGE_PATIENTS_URL, ADMIN_SETTINGS_URL
} from "@/lib/constants";
import {usePathname} from "next/navigation";
import {cn} from "@/lib/utils";

export default function AdminSideBar() {

    const currentPath = usePathname();

    return (
        <aside className="fixed inset-y-0 left-0 z-10 hidden w-14 flex-col border-r bg-background sm:flex">
            <nav className="flex flex-col items-center gap-4 px-2 sm:py-5">
                <Link
                    href={ADMIN_DASHBOARD_URL}
                    className="group flex h-9 w-9 shrink-0 items-center justify-center gap-2 rounded-full bg-primary text-lg font-semibold text-primary-foreground md:h-8 md:w-8 md:text-base"
                >
                    <Home className="h-4 w-4 transition-all group-hover:scale-110"/>
                    <span className="sr-only">TheraChat Eswatini</span>
                </Link>
                <TooltipProvider>
                    <Tooltip>
                        <TooltipTrigger asChild>
                            <Link
                                href={ADMIN_MANAGE_CLIENT_URL}
                                className={cn(
                                    "flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8",
                                    currentPath.includes(ADMIN_MANAGE_CLIENT_URL) && "bg-accent text-accent-foreground"
                                )}
                            >
                                <Hospital className="h-5 w-5"/>
                                <span className="sr-only">Manage Clients</span>
                            </Link>
                        </TooltipTrigger>
                        <TooltipContent side="right">Manage Clients</TooltipContent>
                    </Tooltip>
                    <Tooltip>
                        <TooltipTrigger asChild>
                            <Link
                                href={ADMIN_MANAGE_PATIENTS_URL}
                                className={cn(
                                    "flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8",
                                    currentPath.includes(ADMIN_MANAGE_PATIENTS_URL) && "bg-accent text-accent-foreground"
                                )}
                            >
                                <Users2 className="h-5 w-5"/>
                                <span className="sr-only">Manage Patients</span>
                            </Link>
                        </TooltipTrigger>
                        <TooltipContent side="right">Manage Patients</TooltipContent>
                    </Tooltip>
                    {/*<Tooltip>*/}
                    {/*    <TooltipTrigger asChild>*/}
                    {/*        <Link*/}
                    {/*            href="#"*/}
                    {/*            className={cn(*/}
                    {/*                "flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8",*/}
                    {/*                currentPath.includes(ADMIN_MANAGE_PATIENTS_URL) && "bg-accent text-accent-foreground"*/}
                    {/*            )}*/}
                    {/*        >*/}
                    {/*            <Package className="h-5 w-5"/>*/}
                    {/*            <span className="sr-only">Products</span>*/}
                    {/*        </Link>*/}
                    {/*    </TooltipTrigger>*/}
                    {/*    <TooltipContent side="right">Products</TooltipContent>*/}
                    {/*</Tooltip>*/}
                    {/*<Tooltip>*/}
                    {/*    <TooltipTrigger asChild>*/}
                    {/*        <Link*/}
                    {/*            href="#"*/}
                    {/*            className="flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8"*/}
                    {/*        >*/}
                    {/*            <Activity className="h-5 w-5"/>*/}
                    {/*            <span className="sr-only">Customers</span>*/}
                    {/*        </Link>*/}
                    {/*    </TooltipTrigger>*/}
                    {/*    <TooltipContent side="right">Customers</TooltipContent>*/}
                    {/*</Tooltip>*/}
                    <Tooltip>
                        <TooltipTrigger asChild>
                            <Link
                                href={ADMIN_ANALYTICS_URL}
                                className={cn(
                                    "flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8",
                                    currentPath.includes(ADMIN_ANALYTICS_URL) && "bg-accent text-accent-foreground"
                                )}
                            >
                                <LineChart className="h-5 w-5"/>
                                <span className="sr-only">Analytics</span>
                            </Link>
                        </TooltipTrigger>
                        <TooltipContent side="right">Analytics</TooltipContent>
                    </Tooltip>
                </TooltipProvider>
            </nav>
            <nav className="mt-auto flex flex-col items-center gap-4 px-2 sm:py-5">
                <TooltipProvider>
                    <Tooltip>
                        <TooltipTrigger asChild>
                            <Link
                                href={ADMIN_SETTINGS_URL}
                                className={cn(
                                    "flex h-9 w-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:text-foreground md:h-8 md:w-8",
                                    currentPath.includes(ADMIN_SETTINGS_URL) && "bg-accent text-accent-foreground"
                                )}
                            >
                                <Settings className="h-5 w-5"/>
                                <span className="sr-only">Settings</span>
                            </Link>
                        </TooltipTrigger>
                        <TooltipContent side="right">Settings</TooltipContent>
                    </Tooltip>
                </TooltipProvider>
            </nav>
        </aside>
    )
}

