import { useLocalization } from '@/utils/hooks/useLocalization'
import { Helmet } from 'react-helmet'
import { useState } from 'react'
import IntranetSidebar from './intranet/Sidebar'
import LeaveManagement from './intranet/HR/LeaveManagement'
import OvertimeManagement from './intranet/HR/OvertimeManagement'
import ExpenseManagement from './intranet/HR/ExpenseManagement'
import EventsModule from './intranet/Event'
import DocumentsModule from './intranet/Document'
import TasksModule from './intranet/Task'
import SocialWall from './intranet/SocialWall'
import BirthdaysModule from './intranet/Birthday'
import TrainingModule from './intranet/Training'
import ReservationsModule from './intranet/Reservation'
import CafeteriaModule from './intranet/Cafeteria'
import SurveysModule from './intranet/Survey'
import VisitorsModule from './intranet/Visitor'
import AnnouncementsModule from './intranet/Announcement'
import IntranetDashboard from './intranet/Dashboard'

const Dashboard = () => {
  const { translate } = useLocalization()
  const [currentPath, setCurrentPath] = useState('/intranet/dashboard')

  const renderContent = () => {
    switch (currentPath) {
      case '/intranet/dashboard':
        return <IntranetDashboard />
      case '/intranet/social':
        return <SocialWall />
      case '/intranet/hr/leave':
        return <LeaveManagement />
      case '/intranet/hr/overtime':
        return <OvertimeManagement />
      case '/intranet/hr/expense':
        return <ExpenseManagement />
      case '/intranet/announcements':
        return <AnnouncementsModule />
      case '/intranet/events':
        return <EventsModule />
      case '/intranet/documents':
        return <DocumentsModule />
      case '/intranet/tasks':
        return <TasksModule />
      case '/intranet/birthdays':
        return <BirthdaysModule />
      case '/intranet/training':
        return <TrainingModule />
      case '/intranet/reservations':
        return <ReservationsModule />
      case '/intranet/cafeteria/menu':
      case '/intranet/cafeteria/shuttle':
        return <CafeteriaModule />
      case '/intranet/surveys':
        return <SurveysModule />
      case '/intranet/visitors':
        return <VisitorsModule />
      default:
        return <IntranetDashboard />
    }
  }

  return (
    <>
      <Helmet
        titleTemplate="%s | Sözsoft Kurs Platform"
        title={translate('::' + 'Dashboard')}
        defaultTitle="Sözsoft Kurs Platform"
      />
      <div className="flex min-h-screen bg-gray-50 dark:bg-gray-900">
        <IntranetSidebar activePath={currentPath} onNavigate={setCurrentPath} />
        <div className="flex-1 overflow-y-auto">
          {renderContent()}
        </div>
      </div>
    </>
  )
}

export default Dashboard

