// @design-system: layout/BottomNav
/**
 * useCustomerNavItems - returns the standard customer BottomNav items.
 *
 * Centralises the nav definition so it never has to be duplicated across islands.
 * Pass the current page's path as `activePath` to mark the right tab active.
 */

import { useMemo } from 'react';
import { useT } from '@/lib/i18n/react';
import { Icon } from '@/components/ui/icons/Icon';
import { BASE_ALWAYS_ITEMS, BASE_LOGGED_IN_ITEMS } from '@/lib/nav/customer-nav-items';
import type { BottomNavItem } from './BottomNav';

export function useCustomerNavItems(
  activePath: string,
  { isGuest = false }: { isGuest?: boolean } = {},
): BottomNavItem[] {
  const tNav = useT('nav');
  return useMemo(
    () =>
      [...BASE_ALWAYS_ITEMS, ...(!isGuest ? BASE_LOGGED_IN_ITEMS : [])].map((item) => ({
        href: item.href,
        icon: <Icon name={item.iconName} size="sm" />,
        label: tNav(item.labelKey as 'home'),
        active: item.activeMatch(activePath),
      })),
    [tNav, activePath, isGuest],
  );
}
