import { BrowserRouter, Route, Routes } from 'react-router-dom';
import { PrivateRoutes, PublicRoutes } from './config/routes';
import Dashboard from './pages/dashboard/Dashboard';
import Login from './pages/login/Login';
import AuthGuard from './guards/AuthGuard';
import NotFound from './pages/NotFound';
import { ToastContainer } from 'react-toastify';

import Home from './pages/home/Home';
import Register from './pages/register/Register';
import Users from './pages/users/Users';
import Faults from './pages/faults/Faults';

function App() {
  return (
    <BrowserRouter>
      <Routes>
        <Route path={PublicRoutes.LOGIN} element={<Login />} />
        <Route path={PublicRoutes.REGISTER} element={<Register />} />
        <Route path={PublicRoutes.HOME} element={<Home />} />
        <Route element={<AuthGuard />}>
          <Route path={PrivateRoutes.DASHBOARD} element={<Dashboard />} />
          <Route path={PrivateRoutes.FAULTS} element={<Faults />} />
          <Route path={PrivateRoutes.USERS} element={<Users />} />
          <Route path='*' element={<NotFound />} />
        </Route>
        <Route path='*' element={<NotFound />} />
      </Routes>
      <ToastContainer theme='dark' />
    </BrowserRouter>
  );
}

export default App;
