import { Routes, Route } from "react-router-dom"
import AdminLayout from "./AdminLayout"
import Courses from "./pages/Courses"
import Chapters from "./pages/Chapters"
import Lectures from "./pages/Lectures"
import Topics from "./pages/Topics"
import AdminLogin from "./pages/AdminLogin"
import AdminGuard from "../utils/AdminGuard"
import Batch from "./pages/Batch"
import Subjects from "./pages/Subjects"
import Students from "./pages/Students"
import Archived from "./pages/Archived"
import CreateAccount from "./pages/CreateAccount"
import ArchivedBatches from "./pages/ArchivedBatches"

export default function AdminRoutes() {
  return (
    <Routes>
      {/* LOGIN — PUBLIC */}
      <Route path="login" element={<AdminLogin />} />

      {/* PROTECTED ADMIN AREA */}
      <Route
        element={
          <AdminGuard>
            <AdminLayout />
          </AdminGuard>
        }
      >
        <Route index element={<Courses />} />
        <Route path="courses" element={<Courses />} />
        <Route path="courses/:courseId/chapters" element={<Chapters />} />
        <Route path="topics/:topicId/lectures" element={<Lectures />} />
        <Route path="chapters/:chapterId/topics" element={<Topics />} />
        <Route path="batch" element={<Batch />} />
        <Route path="subjects" element={<Subjects />} />
        <Route path="students" element={<Students />} />
        <Route path="archived" element={<Archived />} />
        <Route path="create-account" element={<CreateAccount />} />
        <Route path="archived-batches" element={<ArchivedBatches />} />
      </Route>
    </Routes>
  )
}
