import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import Modaliz from 'react-modaliz';

import block from '../../../helpers/bem-cn';

import Button from '../../buttons/Button';

import './ConfirmationModal.css';

import {
    // openConfirmationModal,
    closeConfirmationModal,
} from '../../../store/actions';

const propTypes = {
    // className: PropTypes.string,
    closeModal: PropTypes.func.isRequired,
    needConfirm: PropTypes.bool.isRequired,
    message: PropTypes.string.isRequired,
    title: PropTypes.string.isRequired,
    // status: PropTypes.string.isRequired,
    // statusText: PropTypes.string.isRequired,
};

const defaultProps = {
    message: '',
};

const b = block('j-confirmation');

const ConfirmationModal = ({
    // className,
    closeModal,
    message,
    needConfirm,
    onConfirm,
    title,
    // statusText,
}) => {
    const handleClose = () => {
        closeModal();
    };

    return (
        <Modaliz
            className={b()}
            show={needConfirm}
            speed={500}
            onClose={handleClose}
            discardDefaults
        >
            <div className={b('inner')}>
                <div className={b('title')}>
                    {title}
                </div>
                <div className={b('body')}>
                    <div className={b('text')}>
                        {message}
                    </div>
                </div>
            </div>
            <div className={b('buttons-group').mix('j-buttons__wrapper')}>
                <Button mod="default" onClick={handleClose}>Cancel</Button>
                <Button mod="primary" onClick={onConfirm}>OK</Button>
            </div>
        </Modaliz>
    );
};

ConfirmationModal.propTypes = propTypes;
ConfirmationModal.defaultProps = defaultProps;

const mapStateToProps = (state) => {
    const {
        message,
        needConfirm,
        onConfirm,
        title,
    } = state.apiResponseModalReducer;

    return {
        message,
        needConfirm,
        onConfirm,
        title,
    };
};

export default connect(
    mapStateToProps,
    {
        // openConfirmationModal,
        closeModal: closeConfirmationModal,
    },
)(ConfirmationModal);

@@ -271,38 +271,8 @@
 t %7B%0A
-    // openConfirmationModal,%0A
     
@@ -295,16 +295,16 @@
 nModal,%0A
+
 %7D from '
@@ -353,44 +353,8 @@
 = %7B%0A
-    // className: PropTypes.string,%0A
     
@@ -522,100 +522,8 @@
 ed,%0A
-    // status: PropTypes.string.isRequired,%0A    // statusText: PropTypes.string.isRequired,%0A
 %7D;%0A%0A
@@ -635,26 +635,8 @@
  (%7B%0A
-    // className,%0A
     
@@ -688,24 +688,24 @@
  onConfirm,%0A
+
     title,%0A 
@@ -707,27 +707,8 @@
 le,%0A
-    // statusText,%0A
 %7D) =
@@ -1961,42 +1961,8 @@
   %7B%0A
-        // openConfirmationModal,%0A
     

remove redundant stuff