"use client";
import { NavigationLink } from "@/components/ui";
import { autogestionUrl, links } from "@/data/navigation";
import { cn } from "@/lib/utils";
import { Path } from "@/store/navigation-store";
import { usePathname } from "next/navigation";

const footerLinks = [...links.slice(0, 3), { href: autogestionUrl, label: "Autogestión" }];

const FooterLinks = () => {
  const pathname = usePathname();
  return (
    <ul className="space-y-3">
      {footerLinks.map((link) => (
        <li key={link.href}>
          {link.label === "Autogestión" ? (
            <a href={link.href} className="contigo-link-tertiary" target="_blank" rel="noopener noreferrer">
              {link.label}
            </a>
          ) : (
            <NavigationLink
              path={link.href as Path}
              role="menuitem"
              className={cn("contigo-link-tertiary", { "pointer-events-none font-medium": pathname === link.href })}
            >
              {link.label}
            </NavigationLink>
          )}
        </li>
      ))}
    </ul>
  );
};

export default FooterLinks;
