import React from 'react';
import { Routes, Route, Navigate } from 'react-router-dom';

import AdminLayout from '../../components/layout/admin/AdminLayout';
import NotFound from './NotFound';

import Dashboard from './dashboard/views/Dashboard';
import ManageStudents from './manage_students/views/ManageStudents';
import ManageTeachers from './manage_teachers/views/ManageTeachers';
import ManageClasses from './manage_classes/views/ManageClasses';
import ClassDetail from './manage_classes/views/ClassDetail';
import ManageSections from './manage_section/views/ManageSections';
import ManageTopics from './manage_topics/views/ManageTopics';
import ManageMaterials from './manage_materials/views/ManageMaterials';
import EditorMaterial from './manage_materials/views/EditorMaterial';
import ManageExercises from './manage_exercises/views/ManageExercises';
import OldManageExercises from './manage_exercises/views/OldManageExercises';
import ExerciseDetail from './manage_exercises/views/ExerciseDetail';
import UpdateExercises from './manage_exercises/views/UpdateExercise';
import ManageProgress from './manage_progress/views/ManageProgress';
import StudentProgress from './manage_progress/views/StudentProgress';
import ClassProgress from './manage_progress/views/ClassProgress';
import ManageReports from './manage_reports/views/ManageReports';
import Setting from './setting/views/Setting';
import '../../assets/styles/admin.css'

import ProtectedRoute from '../../utils/ProtectedRoute';

const AdminRoutes = () => {
  return (
    <AdminLayout>
      <Routes>
        <Route element={<ProtectedRoute role="admin" />}>
          <Route path="*" element={<NotFound/>} />
          <Route path="/" element={<Navigate to="dashboard" replace />} />
          <Route path="dashboard" element={<Dashboard />} />
          <Route path="student" element={<ManageStudents />} />
          <Route path="teacher" element={<ManageTeachers />} />
          <Route path="class" element={<ManageClasses />} />
          <Route path="class/class-detail" element={<ClassDetail />} />
          <Route path="class/class-detail/:classId" element={<ClassDetail />} />
          <Route path="section" element={<ManageSections />} />
          <Route path="topic" element={<ManageTopics />} />
          <Route path="material" element={<ManageMaterials />} />
          <Route path="material/update-material/:materialId" element={<EditorMaterial />} />
          <Route path="exercise" element={<ManageExercises />} />
          <Route path="exercise/old" element={<OldManageExercises />} />
          <Route path="exercise/exercise-detail/:levelId" element={<ExerciseDetail />} />
          <Route path="exercise/update-exercise/:levelId" element={<UpdateExercises />} />
          <Route path="learning-progress" element={<ManageProgress />} />
          <Route path="learning-progress/s/:progressId" element={<StudentProgress />} />
          <Route path="learning-progress/c/:progressId" element={<ClassProgress />} />
          <Route path="report" element={<ManageReports />} />
          <Route path="profile" element={<Setting />} />
        </Route>

          {/* <Route path="*" element={<NotFound/>} />
          <Route path="/" element={<Navigate to="dashboard" replace />} />
          <Route path="dashboard" element={<Dashboard />} />
          <Route path="student" element={<ManageStudents />} />
          <Route path="teacher" element={<ManageTeachers />} />
          <Route path="class" element={<ManageClasses />} />
          <Route path="class/class-detail" element={<ClassDetail />} />
          <Route path="section" element={<ManageSections />} />
          <Route path="topic" element={<ManageTopics />} />
          <Route path="material" element={<ManageMaterials />} />
          <Route path="exercise" element={<ManageExercises />} />
          <Route path="exercise/exercise-detail" element={<ExerciseDetail />} />
          <Route path="learning-progress" element={<ManageProgress />} />
          <Route path="learning-progress/student" element={<StudentProgress />} />
          <Route path="report" element={<ManageReports />} />
          <Route path="setting" element={<Setting />} /> */}

      </Routes>
    </AdminLayout>
  );
};

export default AdminRoutes;
