/* eslint-disable */
import React from "react";
import { Redirect, Route, Switch } from "react-router-dom";

import {
  LOGIN_PAGE,
  HOME_PAGE,
  NOT_FOUND_PAGE,
  ERROR_PAGE,
  BASE_PAGE,
  FORGOT_PASSWORD_MAIL_SENT,
  REGISTER_PAGE,
  REGISTER_SUCCESSFUL_PAGE,
  RESET_PASSWORD_PAGE,
  CREATE_OFFER_PAGE,
  ITEM_DETAILS_PAGE,
  FORGOT_PASSWORD_PAGE,
  PROFILE_PAGE,
  CHAT_MESSAGE_PAGE,
  CHAT_PAGE,
  MY_OFFERS_PAGE,
} from "./constants/pages";
import LoginPage from "./pages/LoginPage/LoginPage";
import HomePage from "./pages/HomePage/HomePageMUI";
import NotFoundPage from "./pages/ErrorPages/NotFoundPage";
import ErrorPage from "./pages/ErrorPages/ErrorPage";
import ForgotPasswordPage from "./pages/ForgotPasswordPage/ForgotPasswordPage";
import PrivateRoute from "./components/Router/PrivateRoute";
import MailSent from "./pages/ForgotPasswordPage/ForgotPasswordMailSent/MailSent";
import Register from "./pages/RegisterPages/Register/Register";
import RegisterSuccessful from "./pages/RegisterPages/RegisterSuccessful.js/RegisterSuccessful";
import ResetPasswordPage from "./pages/ResetPasswordPage/ResetPasswordPage";
import CreateOffer from "./pages/CreateOffer/CreateOffer";
import ItemDetailsPage from "./pages/ItemDetailsPage/ItemDetailsPageMUI";
import ProfilePage from "./pages/ProfilePage/ProfilePage";
import ChatMessagesPage from "./pages/ChatMessages/ChatMessages";
import ChatPage from "./pages/Chat/Chat";
import MyOffers from "./pages/MyOffers/MyOffers";

const AppRoutes = () => {
  return (
    <Switch>
      <Route exact path={BASE_PAGE} component={HomePage} />
      <Route exact path={LOGIN_PAGE} component={LoginPage} />
      <Route path={NOT_FOUND_PAGE} component={NotFoundPage} />
      <Route path={REGISTER_SUCCESSFUL_PAGE} component={RegisterSuccessful} />
      <Route path={REGISTER_PAGE} component={Register} />
      <Route path={ERROR_PAGE} component={ErrorPage} />
      <Route path={FORGOT_PASSWORD_MAIL_SENT} component={MailSent} />
      <Route path={FORGOT_PASSWORD_PAGE} component={ForgotPasswordPage} />
      <Route path={RESET_PASSWORD_PAGE} component={ResetPasswordPage} />
      <Route path={CREATE_OFFER_PAGE} component={CreateOffer} />
      <Route path={ITEM_DETAILS_PAGE} component={ItemDetailsPage} />
      <Route path={PROFILE_PAGE} component={ProfilePage} />
      <Route
        path={HOME_PAGE}
        component={(props) => {
          return <HomePage key={props.match.params.id} />;
        }}
      />
      <PrivateRoute path={CHAT_MESSAGE_PAGE} component={ChatMessagesPage} />
      <PrivateRoute path={CHAT_PAGE} component={ChatPage} />
      <PrivateRoute path={MY_OFFERS_PAGE} component={MyOffers} />
      <Redirect from="*" to={NOT_FOUND_PAGE} />
    </Switch>
  );
};

export default AppRoutes;
