import PropTypes from 'prop-types';
import Modal from './modal';
import Button from './buttons/button';

function ConfirmModal(props) {
  return (
    <Modal
      showModal={props.showModal}
      showCloseButton={false}
      onClose={props.onCancel}
      header={props.header}
      body={props.content}
      footer={
        <div className='flex justify-end gap-2'>
          <Button color='green' content='بلی' onClick={props.onConfirm} />
          <Button color='red' content='خیر' onClick={props.onCancel} />
        </div>
      }
    />
  );
}

ConfirmModal.defaultProps = {
  showCloseButton: true
};

ConfirmModal.propTypes = {
  showModal: PropTypes.bool.isRequired,
  header: PropTypes.node,
  content: PropTypes.node.isRequired,
  onConfirm: PropTypes.func.isRequired,
  onCancel: PropTypes.func.isRequired,
  showCloseButton: PropTypes.bool.isRequired
};

export default ConfirmModal;
