import Modal from 'react-bootstrap/Modal';
import Button from 'react-bootstrap/Button';

interface DangerModalProps {
  show: boolean;
  handleClose: () => void;
  title: string;
  bodyText: string;
  confirmButtonText: string;
  onPrimaryAction: () => void;
}

const DangerModal: React.FC<DangerModalProps> = ({
  show,
  handleClose,
  title,
  bodyText,
  confirmButtonText,
  onPrimaryAction,
}) => {
  return (
    <Modal show={show} onHide={handleClose}>
      <Modal.Header closeButton>
        <Modal.Title>{title}</Modal.Title>
      </Modal.Header>
      <Modal.Body>
        <span className='text-danger'>
          <b>Warning:</b> this action is irreversible.
        </span>{' '}
        {bodyText}
      </Modal.Body>
      <Modal.Footer>
        <Button variant='secondary' onClick={handleClose}>
          Cancel
        </Button>
        <Button variant='danger' onClick={onPrimaryAction}>
          {confirmButtonText}
        </Button>
      </Modal.Footer>
    </Modal>
  );
};

export default DangerModal;
