import "bootstrap/dist/css/bootstrap.min.css";
import React from "react";
import { useSelector } from "react-redux";
import {
  Navigate,
  Route,
  BrowserRouter as Router,
  Routes
} from "react-router-dom";

import { getNotification } from "@redux/outstaffingSlice";

import { AuthForCandidate } from "@pages/AuthForCandidate/AuthForCandidate";
import CatalogSpecialists from "@pages/CatalogSpecialists/CatalogSpecialists";
import { CompanyInfo } from "@pages/CompanyInfo/CompanyInfo";
import { FrequentlyAskedQuestion } from "@pages/FrequentlyAskedQuestion/FrequentlyAskedQuestion";
import { FrequentlyAskedQuestions } from "@pages/FrequentlyAskedQuestions/FrequentlyAskedQuestions";
import { PartnerAddRequest } from "@pages/PartnerAddRequest/PartnerAddRequest";
import { PartnerBid } from "@pages/PartnerBid/PartnerBid";
import { PartnerEmployeeReport } from "@pages/PartnerEmployeeReport/PartnerEmployeeReport";
import { PartnerEmployees } from "@pages/PartnerEmployees/PartnerEmployees";
import { PartnerRequests } from "@pages/PartnerRequests/PartnerRequests";
import { PartnerSettings } from "@pages/PartnerSettings/PartnerSettings";
import { PartnerTreaties } from "@pages/PartnerTreaties/PartnerTreaties";
import { PartnerCategories } from "@pages/PartnerСategories/PartnerСategories";
import { Payouts } from "@pages/Payouts/Payouts";
import { Profile } from "@pages/Profile/Profile";
import { ProfileCandidate } from "@pages/ProfileCandidate/ProfileCandidate";
import { ProjectTracker } from "@pages/ProjectTracker/ProjectTracker";
import { PassingTests } from "@pages/Quiz/PassingTests";
import { QuizPage } from "@pages/Quiz/QuizPage";
import { QuizReportPage } from "@pages/Quiz/QuizReportPage";
import { RegistrationForCandidate } from "@pages/RegistrationForCandidate/RegistrationForCandidate";
import { RegistrationSetting } from "@pages/RegistrationSetting/RegistrationSetting";
import Statistics from "@pages/Statistics/Statistics";
import { Summary } from "@pages/Summary/Summary";
import { Tracker } from "@pages/Tracker/Tracker";
import { TrackerAuth } from "@pages/TrackerAuth/TrackerAuth";
import { TrackerIntro } from "@pages/TrackerIntro/TrackerIntro";
import { TrackerRegistration } from "@pages/TrackerRegistration/TrackerRegistration";
import { ViewReport } from "@pages/ViewReport/ViewReport";

import { TicketFullScreen } from "@components/Modal/Tracker/TicketFullScreen/TicketFullScreen";
import Notification from "@components/Notification/Notification";
import { ProfileCalendar } from "@components/ProfileCalendar/ProfileCalendar";

import "./assets/fonts/stylesheet.css";
import "./assets/global.scss";
import Calendar from "./components/Calendar/Calendar";
import Candidate from "./components/Candidate/Candidate";
import FreeDevelopers from "./components/FreeDevelopers/FreeDevelopers";
import ReportForm from "./components/ReportForm/ReportForm";
import Article from "./pages/Article/Article";
import Auth from "./pages/Auth/Auth";
import Blog from "./pages/Blog/Blog";
import FormPage from "./pages/FormPage/FormPage";
import Home from "./pages/Home/Home";
import SingleReportPage from "./pages/SingleReportPage/SingleReportPage";

const App = () => {
  const notification = useSelector(getNotification);
  return (
    <>
      <Router>
        <Routes>
          <Route exact path="/auth" element={<Auth />} />
          <Route exact path="/tracker-intro" element={<TrackerIntro />} />
          <Route exact path="/tracker-auth" element={<TrackerAuth />} />
          <Route
            exact
            path="/tracker-registration"
            element={<TrackerRegistration />}
          />
          <Route exact path="/company" element={<CompanyInfo />} />
          <Route
            exact
            path="/registration-setting"
            element={<RegistrationSetting />}
          />
          <Route
            exact
            path="/catalog-specialists"
            element={<CatalogSpecialists />}
          />

          <Route exact path="/worker/:id" element={<FreeDevelopers />} />
          <Route
            exact
            path="/tracker/task/:id"
            element={<TicketFullScreen />}
          ></Route>
          <Route
            exact
            path="/tracker/project/:id"
            element={<ProjectTracker />}
          />

          <Route exact path="/auth-candidate" element={<AuthForCandidate />} />
          <Route
            exact
            path="/registration-candidate"
            element={<RegistrationForCandidate />}
          />

          <Route exact path="/blog" element={<Blog />}></Route>
          <Route exact path="/blog/article/:id" element={<Article />}></Route>
          <Route
            exact
            path="/frequently-asked-questions"
            element={<FrequentlyAskedQuestions />}
          />
          <Route
            exact
            path="/frequently-asked-question/:id"
            element={<FrequentlyAskedQuestion />}
          />

          <Route exact path="/candidate/:id" element={<Candidate />} />
          <Route exact path="/candidate/:id/form" element={<FormPage />} />
          <Route path="/:userId/calendar" element={<Calendar />} />

          <Route path="/report/:id" element={<SingleReportPage />} />

          <Route exact path="profile">
            <Route index element={<Profile />} />
            <Route exact path="catalog" element={<Home />} />
            <Route exact path="calendar" element={<ProfileCalendar />} />
            <Route exact path="calendar/report" element={<ReportForm />} />
            <Route
              exact
              path="calendar/view/:date/:id"
              element={<ViewReport />}
            />
            <Route exact path="summary" element={<Summary />} />
            <Route exact path="tracker" element={<Tracker />} />
            <Route exact path="statistics/:id" element={<Statistics />} />
            <Route exact path="payouts" element={<Payouts />} />
            <Route exact path="settings" element={<PartnerSettings />} />
            <Route exact path="requests" element={<PartnerRequests />} />
            <Route exact path="requests-add" element={<PartnerAddRequest />} />
            <Route exact path="requests-edit" element={<PartnerAddRequest />} />
            <Route exact path="requests-bid" element={<PartnerBid />} />
            <Route exact path="employees" element={<PartnerCategories />} />
            <Route
              exact
              path="employees/report/:uuid"
              element={<PartnerEmployeeReport />}
            />
            <Route exact path="treaties" element={<PartnerTreaties />} />
            <Route exact path="quiz">
              <Route index element={<QuizPage />} />
              <Route exact path="test/:uuid" element={<PassingTests />} />
              <Route exact path="report/:uuid" element={<QuizReportPage />} />
            </Route>

            <Route
              exact
              path="categories/employees"
              element={<PartnerEmployees />}
            />
          </Route>

          <Route exact path="profile-candidate/:id">
            <Route index element={<ProfileCandidate />} />
          </Route>

          <Route path="*" element={<Navigate to="/auth" replace />} />
        </Routes>
      </Router>
      {notification.show && <Notification />}
    </>
  );
};

export default App;
