import { Redirect, Route } from 'react-router-dom';
import Tab1 from './pages/Tab1';
import Lesson from './pages/Lesson/index';
import Tab2 from './pages/Tab2';
import Tab3 from './pages/Tab3';
import Setting from './pages/Setting/indx';

import QuizzesMainMenu from './pages/QuizzesMainMenu';
import DebugPage from './pages/DebugPage';
import LessonWordPage from './pages/Lesson/WordPage';
import ConnectivesPage from './pages/Lesson/ConnectivesPage';
import Page from './pages/Page';
//
import ListeningPractice from './pages/ListeningPractice';
import QuestionRoute from './pages/ListeningPractice/Route';
import CorrectionRoute from './pages/ListeningPractice/Route/CorrectionRoute';
import PracticeResult from './pages/ListeningPractice/Result';
import PracticeFinish from './pages/ListeningPractice/Finish';
//
import MatchingFrenzySelectCategory from './pages/MatchingFrenzy/SelectCategory';
import MatchingFrenzyMatchRun from './pages/MatchingFrenzy/MatchRun';
import MatchingFrenzyMatchFinished from './pages/MatchingFrenzy/Finished';
// import CorrectionRoute from './pages/MatchingFrenzy/Route/Correction';
// import PracticeFinish from './pages/MatchingFrenzy/Finish';
import ConnectiveRevisionSelectCategory from './pages/ConnectiveRevision/SelectCategory';
import ConnectiveRevisionQuizRun from './pages/ConnectiveRevision/QuizRun';
import ConnectiveRevisionQuizResult from './pages/ConnectiveRevision/Result';
//
import MyAchievementPage from './pages/Record/index';
import {
  CONNECTIVE_REVISION_LINK,
  DEBUG_LINK,
  FAVORITE_LINK,
  LESSON_LINK,
  LISTENING_PRACTICE_LINK,
  MATCHING_FRENZY_LINK,
  QUIZ_MAIN_MENU_LINK,
  RECORD_LINK
} from './constants';
import MatchingFrenzyMatchResult from './pages/MatchingFrenzy/Result';
import FavVocabularyPage from './pages/Favorite/Vocabulary';
import FavConnectivesPage from './pages/Favorite/Connectives';
import FavoriteVocabularyPage from './pages/Favorite/WordPage';
import ConnectivesWordPage from './pages/Favorite/ConnectivesWordPage';
import { IonBackdrop } from '@ionic/react';

function RouteConfig() {
  return (
    <>
      {/*  */}
      <Route exact path={QUIZ_MAIN_MENU_LINK}>
        <QuizzesMainMenu />
      </Route>
      {/*  */}
      <Route exact path={RECORD_LINK}>
        <MyAchievementPage />
      </Route>
      {/*  */}
      <Route exact path={LESSON_LINK}>
        <Lesson />
      </Route>
      {/*  */}

      <Route exact path={`${LISTENING_PRACTICE_LINK}/c/:p_route`}>
        <CorrectionRoute />
      </Route>
      <Route exact path={`${LISTENING_PRACTICE_LINK}/r/:p_route`}>
        <QuestionRoute />
      </Route>
      <Route exact path={`${LISTENING_PRACTICE_LINK}/finished`}>
        <PracticeFinish />
      </Route>
      <Route exact path={`${LISTENING_PRACTICE_LINK}/result`}>
        <PracticeResult />
      </Route>
      <Route exact path={LISTENING_PRACTICE_LINK}>
        <ListeningPractice />
      </Route>
      {/*  */}
      <Route exact path={`${CONNECTIVE_REVISION_LINK}/r/:p_route`}>
        <ConnectiveRevisionQuizRun />
      </Route>
      <Route exact path={`${CONNECTIVE_REVISION_LINK}/finished`}>
        <ConnectiveRevisionQuizResult />
      </Route>
      <Route exact path={CONNECTIVE_REVISION_LINK}>
        <ConnectiveRevisionSelectCategory />
      </Route>
      {/*  */}
      <Route exact path={`${MATCHING_FRENZY_LINK}/r/:p_route`}>
        <MatchingFrenzyMatchRun />
      </Route>
      <Route exact path={`${MATCHING_FRENZY_LINK}/finished`}>
        <MatchingFrenzyMatchFinished />
      </Route>
      <Route exact path={`${MATCHING_FRENZY_LINK}/result`}>
        <MatchingFrenzyMatchResult />
      </Route>
      <Route exact path={MATCHING_FRENZY_LINK}>
        <MatchingFrenzySelectCategory />
      </Route>

      <Route exact path={`${FAVORITE_LINK}/v/:lesson_idx/:cat_idx/:word_idx`}>
        <FavoriteVocabularyPage />
      </Route>
      <Route exact path={`${FAVORITE_LINK}/v`}>
        <FavVocabularyPage />
      </Route>

      <Route exact path={`${FAVORITE_LINK}/c/:lesson_idx/:cat_idx/:word_idx`}>
        {/* <FavoriteVocabularyPage /> */}
        {/* <FavConnectivesContentPage /> */}
        <ConnectivesWordPage />
      </Route>
      <Route exact path={`${FAVORITE_LINK}/c`}>
        <FavConnectivesPage />
      </Route>

      <Route exact path='/lesson_word_page/v/:lesson_idx/:cat_idx/:word_idx'>
        <LessonWordPage />
      </Route>
      <Route exact path='/lesson_word_page/c/:lesson_idx/:cat_idx/:word_idx'>
        <ConnectivesPage />
      </Route>

      {/* TODO: remove below */}
      <Route exact path='/tab1'>
        <Tab1 />
      </Route>
      <Route exact path='/tab2'>
        <Tab2 />
      </Route>
      <Route path='/tab3'>
        <Tab3 />
      </Route>
      <Route path='/setting'>
        <Setting />
      </Route>
      <Route path='/page/:name' exact={true}>
        <Page />
      </Route>
      <Route exact path={DEBUG_LINK}>
        <DebugPage />
      </Route>
      <Route exact path='/'>
        <Redirect to={LESSON_LINK} />
      </Route>
    </>
  );
}

export { RouteConfig };
