import HuDialog from '@material-hu/components/design-system/Dialog';

import { useLokaliseTranslation } from 'src/utils/i18n';

type EvaluationCloseModalProps = {
  onClose: () => void;
  onConfirm: () => void;
  onSubmit: () => void;
};

const EvaluationCloseModal = ({
  onClose,
  onConfirm,
  onSubmit,
}: EvaluationCloseModalProps) => {
  const { t } = useLokaliseTranslation(['learning', 'general']);

  return (
    <HuDialog
      onClose={onClose}
      title={t('course.lesson.evaluation.close.title')}
      textBody={t('course.lesson.evaluation.close.description')}
      secondaryButtonProps={{
        children: t('general:cancel'),
        onClick: onClose,
      }}
      primaryButtonProps={{
        children: t('course.lesson.evaluation.close.action'),
        onClick: () => {
          onSubmit();
          onConfirm();
        },
      }}
    />
  );
};

export default EvaluationCloseModal;
