import { Box, Typography } from "@mui/material";
import CustomCheckbox from "@ui_kit/CustomCheckbox";
import CustomTextField from "@ui_kit/CustomTextField";

import { questionStore, updateQuestionsList } from "@root/questions";

import InfoIcon from "../../../assets/icons/InfoIcon";

type SettingDropDownProps = {
  totalIndex: number;
};

export default function SettingDropDown({ totalIndex }: SettingDropDownProps) {
  const { listQuestions } = questionStore();

  return (
    <>
      <Box
        sx={{ display: "flex", width: "100%", justifyContent: "space-between" }}
      >
        <Box sx={{ padding: "20px", width: "100%" }}>
          <Typography sx={{ marginBottom: "15px" }}>
            Настройки ответов
          </Typography>
          <CustomCheckbox label={"Можно несколько"} />
          <Typography sx={{ marginBottom: "15px" }}>
            Текст в выпадающем списке
          </Typography>
          <CustomTextField
            placeholder={"Выберите вариант"}
            text={listQuestions[totalIndex].content.default}
            onChange={({ target }) => {
              const clonContent = listQuestions[totalIndex].content;
              clonContent.default = target.value;
              updateQuestionsList(totalIndex, { content: clonContent });
            }}
          />
        </Box>
        <Box sx={{ padding: "20px" }}>
          <Typography sx={{ marginBottom: "15px" }}>
            Настройки вопросов
          </Typography>
          <CustomCheckbox label={"Необязательный вопрос"} />
          <CustomCheckbox label={"Внутреннее название вопроса"} /> <InfoIcon />
        </Box>
      </Box>
    </>
  );
}
