import { Box, Typography, Button } from "@mui/material";

import { useCurrentQuiz } from "@root/quizes/hooks";

type ResultFormProps = {
  showContactForm: boolean;
  setShowContactForm: (show: boolean) => void;
  setShowResultForm: (show: boolean) => void;
};

export const ResultForm = ({
  showContactForm,
  setShowContactForm,
  setShowResultForm,
}: ResultFormProps) => {
  const quiz = useCurrentQuiz();

  const followNextForm = () => {
    setShowResultForm(false);
    setShowContactForm(true);
  };

  return (
    <Box>
      <Typography>Форма результатов</Typography>
      {!showContactForm && quiz?.config.resultInfo.when !== "after" && (
        <Button variant="contained" onClick={followNextForm}>
          Показать форму контактов
        </Button>
      )}
    </Box>
  );
};
