import { createHashRouter } from 'react-router-dom'
import DefaultLayout from '../layouts/DefaultLayout'
import Login from '../components/Login'
import LoginLayout from '../layouts/LoginLayout'
import NotFound from '../components/NotFound'
import ForgotPassword from '../components/ForgotPassword'
import Home from '../components/Home'
import Student from '../components/Student'
import Notes from '../components/Notes'
import AddStudent from '../components/AddStudent'
import SingleEtudiant from '../components/SingleEtudiant'
import AddNotes from '../components/AddNotes'
import Apropos from '../components/Apropos'
import Niveau from '../components/Niveau'
import AddNiveau from '../components/AddNiveau'
import Admin from '../components/Addadmin'
import Setting from '../components/Param'
import SingleNotes from '../components/SingleNotes'
import ExportEtudiants from '../components/ExportEtudiants'
import SingleNiveau from '../components/singleNiveau'
import Matieres from '../components/Matieres'
import AddMatiere from '../components/AddMatiere'
import ImportMatiere from '../components/ImportMatiere'
import SingleMatiere from '../components/SingleMatiere'
import ImportNiveau from '../components/ImportNiveau'
import SystemeNote from '../components/SystemeNote'
import AnneeScolaire from '../components/AnneeScolaire'
import AddAnneeScolaire from '../components/AddAnneeScolaire'
import Noteclasse from '../components/Noteclasse'
import TesteDatagrid from '../components/TesteDatagrid'
import Manuel from '../components/Manuel'
import Mentions from '../components/Mentions'
import AddMention from '../components/AddMention'
import SinleMention from '../components/SinleMention'
import AssignMatiereToMention from '../components/AssignMatiereToMention'
import AssingMatiereToSemestre from '../components/AssingMatiereToSemestre'
import SingleAnneeScolaire from '../components/SingleAnneeScolaire'
import Parcours from '../components/Parcours'
import ModalExportFichr from '../components/ModalExportFichr'
import Resultat from '../components/Resultat'
import TrancheEcolage from '../components/TrancheEcolage'

// Use createHashRouter instead of createBrowserRouter because the desktop app is in local machine
const Router = createHashRouter([
  {
    path: '/',
    element: <DefaultLayout />,
    children: [
      {
        path: '/', // This will now be accessed as #/
        element: <Home />
      },
      {
        path: '/student',
        element: <Student />
      },
      {
        path: '/notes',
        element: <Notes />
      },
      {
        path: '/addstudent',
        element: <AddStudent />
      },
      {
        path: '/single/:id',
        element: <SingleEtudiant />
      },
      {
        path: '/addnotes/:id/:niveau/:mention_id/:parcours',
        element: <AddNotes />
      },
      {
        path: '/anneescolaire/:id',
        element: <SingleAnneeScolaire />
      },
      {
        path: '/asignmatiere/:id',
        element: <AssignMatiereToMention />
      },
      {
        path: '/asignmatieresemestre/:id',
        element: <AssingMatiereToSemestre />
      },
      {
        path: '/manual',
        element: <Manuel />
      },
      {
        path: '/mention',
        element: <Mentions />
      },
      {
        path: '/addmention',
        element: <AddMention />
      },
      {
        path: '/singlemention/:id',
        element: <SinleMention />
      },
      {
        path: '/apropos',
        element: <Apropos />
      },
      {
        path: '/niveau',
        element: <Niveau />
      },
      {
        path: '/addniveau',
        element: <AddNiveau />
      },
      {
        path: '/para',
        element: <Setting />
      },
      {
        path: '/admin',
        element: <Admin />
      },
      {
        path: '/single/notes/:id/:niveau/:scolaire',
        element: <SingleNotes />
      },
      {
        path: '/exportetudiant',
        element: <ExportEtudiants />
      },
      {
        path: '/single/niveau/:id',
        element: <SingleNiveau />
      },
      {
        path: '/matiere',
        element: <Matieres />
      },
      {
        path: '/addmatiere',
        element: <AddMatiere />
      },
      {
        path: '/addmatiere/import',
        element: <ImportMatiere />
      },
      {
        path: '/singlematiere/:id',
        element: <SingleMatiere />
      },
      {
        path: '/importniveau',
        element: <ImportNiveau />
      },
      {
        path: '/systemenote',
        element: <SystemeNote />
      },
      {
        path: '/anneescolaire',
        element: <AnneeScolaire />
      },
      {
        path: '/addanneescolaire',
        element: <AddAnneeScolaire />
      },
      {
        path: '/noteclass/:niveau/:scolaire',
        element: <Noteclasse />
      },
      {
        path: '/parcours',
        element: <Parcours />
      },
      {
        path: '/fiche/:matiere_id/:nom',
        element: <ModalExportFichr />
      },
      {
        path: '/resultat/:niveau/:scolaire',
        element: <Resultat />
      },
      {
        path: '/tranche/:id',
        element: <TrancheEcolage />
      }
    ]
  },
  {
    path: '/',
    element: <LoginLayout />,
    children: [
      {
        path: '/login',
        element: <Login />
      },
      {
        path: '/forgotpassword',
        element: <ForgotPassword />
      }
    ]
  },
  {
    path: '/*',
    element: <NotFound />
  }
])

export default Router
