'use client'

import { BookOpen, Home, Users } from 'lucide-react'
import { RoleNav, type NavItem, type RoleNavUser } from '@/components/layouts/role-nav'
import { trpc } from '@/lib/trpc/client'

interface MentorNavProps {
  user: RoleNavUser
}

export function MentorNav({ user }: MentorNavProps) {
  const { data: flags } = trpc.settings.getFeatureFlags.useQuery()

  const useExternal = flags?.learningHubExternal && flags.learningHubExternalUrl

  const navigation: NavItem[] = [
    {
      name: 'Dashboard',
      href: '/mentor',
      icon: Home,
    },
    {
      name: 'My Projects',
      href: '/mentor/projects',
      icon: Users,
    },
    {
      name: 'Learning Hub',
      href: useExternal ? flags.learningHubExternalUrl : '/mentor/resources',
      icon: BookOpen,
      external: !!useExternal,
    },
  ]

  return (
    <RoleNav
      navigation={navigation}
      roleName="Mentor"
      user={user}
      basePath="/mentor"
    />
  )
}
