import { Box, Typography } from "@mui/material";
import CustomCheckbox from "@ui_kit/CustomCheckbox";
import InfoIcon from "../../../assets/icons/InfoIcon";
import { questionStore, updateQuestionsList } from "@root/questions";

type SettingsDataProps = {
  totalIndex: number;
};

export default function SettingsData({ totalIndex }: SettingsDataProps) {
  const { listQuestions } = questionStore();

  return (
    <Box sx={{ display: "flex" }}>
      <Box sx={{ padding: "20px" }}>
        <Typography>Настройки календаря</Typography>
        <CustomCheckbox
          label={"Выбор диапозона дат"}
          checked={listQuestions[totalIndex].content.range}
          handleChange={({ target }) => {
            const clonContent = listQuestions[totalIndex].content;
            clonContent.range = target.checked;
            updateQuestionsList(totalIndex, { content: clonContent });
          }}
        />
        <CustomCheckbox
          label={"Выбор времени"}
          checked={listQuestions[totalIndex].content.time}
          handleChange={({ target }) => {
            const clonContent = listQuestions[totalIndex].content;
            clonContent.time = target.checked;
            updateQuestionsList(totalIndex, { content: clonContent });
          }}
        />
      </Box>
      <Box sx={{ padding: "20px" }}>
        <Typography>Настройки вопросов</Typography>
        <CustomCheckbox label={"Необязательный вопрос"} />
        <CustomCheckbox label={"Внутреннее название вопроса"} /> <InfoIcon />
      </Box>
    </Box>
  );
}
