import './App.css'
import {BrowserRouter, Navigate, Route, Routes} from "react-router-dom";
import {SurveyCreateAndEditingPage} from "./pages/SurveyCreateAndEditingPage/SurveyCreateAndEditingPage.tsx";
import Survey from "./components/Survey/Survey.tsx";
import SettingSurvey from "./components/SettingSurvey/SettingSurvey.tsx";
import {MySurveysPage} from "./pages/MySurveysPage/MySurveysPage.tsx";
import {Results} from "./components/Results/Results.tsx";
import {MySurveyList} from "./components/MySurveyList/MySurveyList.tsx";

const App = () => {
    return(
        <BrowserRouter>
            <Routes>
                <Route path="/" element={<Navigate to="/survey/create/questions" replace />} />

                <Route path="survey/create" element={<SurveyCreateAndEditingPage />}>
                    <Route path="questions" element={<Survey />} />
                    <Route path="settings" element={<SettingSurvey />} />
                </Route>

                <Route path="my-surveys" element={<MySurveysPage />}>
                    <Route index element={<MySurveyList />} />
                </Route>

                <Route path='survey/:surveyId' element={<SurveyCreateAndEditingPage />}>
                    <Route path="questions" element={<Survey />} />
                    <Route path="settings" element={<SettingSurvey />} />
                    <Route path="results" element={<Results />} />
                </Route>
            </Routes>
        </BrowserRouter>
    );
}


export default App