'use client'

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

interface ApplicantNavProps {
  user: RoleNavUser
}

export function ApplicantNav({ user }: ApplicantNavProps) {
  const { data: flags } = trpc.applicant.getNavFlags.useQuery(undefined, {
    staleTime: 60_000,
  })

  const navigation: NavItem[] = [
    { name: 'Dashboard', href: '/applicant', icon: Home },
    { name: 'Team', href: '/applicant/team', icon: Users },
    { name: 'Competition', href: '/applicant/competition', icon: Trophy },
    { name: 'Documents', href: '/applicant/documents', icon: FileText },
    ...(flags?.hasEvaluationRounds
      ? [{ name: 'Evaluations', href: '/applicant/evaluations', icon: Star }]
      : []),
    ...(flags?.hasMentor
      ? [{ name: 'Mentoring', href: '/applicant/mentor', icon: MessageSquare }]
      : []),
    { name: 'Resources', href: '/applicant/resources', icon: BookOpen },
  ]

  return (
    <RoleNav
      navigation={navigation}
      roleName="Applicant"
      user={user}
      basePath="/applicant"
    />
  )
}
