import * as React from 'react';

import AnswerOptions from "./answerOptions/AnswerOptions";
import OptionsPicture from "./OptionsPicture/OptionsPicture";
import DataOptions from "./DataOptions/DataOptions";
import SliderOptions from "./SliderOptions/SliderOptions";
import OwnTextField from "./OwnTextField/OwnTextField";
import PageOptions from "./PageOptions/PageOptions";
import OptionsAndPicture from "./OptionsAndPicture/OptionsAndPicture";
import RatingOptions from "./RatingOptions/RatingOptions";
import Emoji from "./Emoji/Emoji";
import DropDown from "./DropDown/DropDown";
import UploadFile from "./UploadFile/UploadFile";
import {useParams} from "react-router-dom";
import {questionStore} from "@root/questions";

interface Props {
    totalIndex: number,
}

export default function SwitchQuestionsPage ({totalIndex }: Props) {
    const params = Number(useParams().quizId);
    const {listQuestions, updateQuestionsList, createQuestion, removeQuestion} = questionStore()
    const switchState = listQuestions[params][totalIndex].type
    switch (switchState) {
        case 'variant':
            return (<AnswerOptions totalIndex={totalIndex}/>);
            break;

        case 'images':
            return (<OptionsPicture totalIndex={totalIndex}/>);
            break;

        case 'varimg':
            return (<OptionsAndPicture totalIndex={totalIndex}/>);
            break;

        case 'emoji':
            return (<Emoji totalIndex={totalIndex}/>);
            break;

        case 'text':
            return (<OwnTextField totalIndex={totalIndex}/>);
            break;

        case 'select':
            return (<DropDown totalIndex={totalIndex}/>);
            break;

        case 'date':
            return (<DataOptions totalIndex={totalIndex}/>);
            break;

        case 'number':
            return (<SliderOptions totalIndex={totalIndex}/>);
            break;

        case 'file':
            return (<UploadFile totalIndex={totalIndex}/>);
            break;

        case 'page':
            return (<PageOptions totalIndex={totalIndex}/>);
            break;

        case 'rating':
            return (<RatingOptions totalIndex={totalIndex}/>);
            break;

        default:
            return (<></>)
    }
}