import { hasSublinks, hasSubtitle } from '@/lib/types/navigation';
import MenuTitle from '@/components/Page/Menu/MenuTitle/';
import MenuSublinks from '@/components/Page/Menu/MenuSublinks/';
import MenuSubtitle from '@/components/Page/Menu/MenuSubtitle/';

import { NavigationItem } from '@/lib/types/navigation';

interface MenuItem {
  item: NavigationItem;
}

export default function MenuItem({ item }: MenuItem) {
  return (
    <>
      <MenuTitle path={item.path} name={item.name} variant={item.variant} />
      {hasSublinks(item) && (
        <MenuSublinks sublinks={item.sublinks.value} variant={item.variant} />
      )}
      {hasSubtitle(item) && (
        <MenuSubtitle subtitle={item.subtitle.value} variant={item.variant} />
      )}
    </>
  );
}
