import { HouseIcon, RankingIcon, ShieldIcon, TrophyIcon, UserCircleIcon } from "@phosphor-icons/react";
import { useMemo } from "react";
import { useLingui } from "@lingui/react/macro";

export const useLinks = (userId: string | undefined, roles: string[]) => {
  const { t } = useLingui();

  return useMemo(() => {
    const links = [
      {
        label: t`Home`,
        href: '/',
        Icon: HouseIcon
      },
      {
        label: t`Statistics`,
        href: '/stats',
        Icon: RankingIcon
      },
      {
        label: t`Tournaments`,
        href: '/tournaments',
        Icon: TrophyIcon,
        exclude: ['/admin/tournaments']
      },
      {
        label: t`Profile`,
        href: `/profile/${userId}`,
        Icon: UserCircleIcon,
        include: ['/settings']
      }
    ]

    if (roles.includes('Admin')) {
      links.push({
        label: t`Admin`,
        href: '/admin',
        Icon: ShieldIcon
      })
    }

    return links;
  }, [userId, roles, t]);
};