import { QuizResultsType, QuizStartpageType, QuizType } from "@model/quizSettings";
import ContactFormPage from "../pages/ContactFormPage/ContactFormPage";
import InstallQuiz from "../pages/InstallQuiz/InstallQuiz";
import FormQuestionsPage from "../pages/Questions/Form/FormQuestionsPage";
import QuestionsPage from "../pages/Questions/QuestionsPage";
import { QuestionsMap } from "../pages/QuestionsMap";
import { Result } from "../pages/Result/Result";
import { Setting } from "../pages/Result/Setting";
import StartPageSettings from "../pages/startPage/StartPageSettings";
import StepOne from "../pages/startPage/stepOne";
import Steptwo from "../pages/startPage/steptwo";


interface Props {
    activeStep: number;
    quizType: QuizType;
    quizStartPageType: QuizStartpageType;
    quizResults: QuizResultsType;
}

export default function SwitchStepPages({
    activeStep = 1,
    quizType,
    quizStartPageType,
    quizResults,
}: Props) {
    switch (activeStep) {
        case 0: {
            if (!quizType) return <StepOne />;
            if (!quizStartPageType) return <Steptwo />;
            return <StartPageSettings />;
        }
        case 1: return quizType === "form" ? <FormQuestionsPage /> : <QuestionsPage />;
        case 2: {
            if (!quizResults) return <Result />;
            return <Setting />;
        }
        case 3: return <QuestionsMap />;
        case 4: return <ContactFormPage />;
        case 5: return <InstallQuiz />;
        case 6: return <>Реклама</>;
        default: throw new Error(`Invalid quiz setup step: ${activeStep}`);
    }
} 
