import { Box, Tooltip, Typography, useMediaQuery, useTheme } from "@mui/material";
import { useState } from "react";
import InfoIcon from "../../../assets/icons/InfoIcon";
import ButtonsOptions from "../ButtonsOptions";
import SwitchData from "./switchData";
import { QuizQuestionDate } from "@model/questionTypes/date";


interface Props {
  question: QuizQuestionDate;
}

export default function DataOptions({ question }: Props) {
  const [switchState, setSwitchState] = useState("setting");
  const theme = useTheme();
  const isMobile = useMediaQuery(theme.breakpoints.down(790));

  const SSHC = (data: string) => {
    setSwitchState(data);
  };

  return (
    <>
      <Box
        sx={{
          width: isMobile ? "auto" : "100%",
          maxWidth: "493px",
          display: "flex",
          pl: "20px",
          pr: "20px",
          flexDirection: "column",
          gap: isMobile ? "18px" : "20px",
        }}
      >
        <Box sx={{ display: "flex", alignItems: "flex-start", gap: "12px", mb: "20px" }}>
          <Typography
            sx={{
              fontWeight: 400,
              fontSize: "16px",
              lineHeight: "18.96px",
              color: theme.palette.grey2.main,
            }}
          >
            Пользователю будет предложено выбрать дату
          </Typography>
          <Tooltip title="Выбор даты." placement="top">
            <Box>
              <InfoIcon />
            </Box>
          </Tooltip>
        </Box>
      </Box>
      <ButtonsOptions switchState={switchState} SSHC={SSHC} question={question} />
      <SwitchData switchState={switchState} question={question} />
    </>
  );
}
