'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = RecordButtonBar;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _immutable = require('immutable');

var _immutable2 = _interopRequireDefault(_immutable);

var _CloneButton = require('./CloneButton');

var _CloneButton2 = _interopRequireDefault(_CloneButton);

var _DeleteButton = require('./DeleteButton');

var _DeleteButton2 = _interopRequireDefault(_DeleteButton);

var _DeprecateButton = require('./DeprecateButton');

var _DeprecateButton2 = _interopRequireDefault(_DeprecateButton);

var _SaveButton = require('./SaveButton');

var _SaveButton2 = _interopRequireDefault(_SaveButton);

var _RevertButton = require('./RevertButton');

var _RevertButton2 = _interopRequireDefault(_RevertButton);

var _UndeprecateButton = require('./UndeprecateButton');

var _UndeprecateButton2 = _interopRequireDefault(_UndeprecateButton);

var _ButtonBar = require('../../../styles/cspace-ui/ButtonBar.css');

var _ButtonBar2 = _interopRequireDefault(_ButtonBar);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const propTypes = {
  isCloneable: _propTypes2.default.bool,
  isDeletable: _propTypes2.default.bool,
  isDeprecated: _propTypes2.default.bool,
  isModified: _propTypes2.default.bool,
  isReadPending: _propTypes2.default.bool,
  isSavePending: _propTypes2.default.bool,
  readOnly: _propTypes2.default.bool,
  showDeprecationButtons: _propTypes2.default.bool,
  validationErrors: _propTypes2.default.instanceOf(_immutable2.default.Map),
  onUndeprecateButtonClick: _propTypes2.default.func,
  onCloneButtonClick: _propTypes2.default.func,
  onDeprecateButtonClick: _propTypes2.default.func,
  onDeleteButtonClick: _propTypes2.default.func,
  onRevertButtonClick: _propTypes2.default.func,
  onSaveButtonClick: _propTypes2.default.func,
  onSaveButtonErrorBadgeClick: _propTypes2.default.func
};

function RecordButtonBar(props) {
  const isCloneable = props.isCloneable,
        isDeletable = props.isDeletable,
        isDeprecated = props.isDeprecated,
        isModified = props.isModified,
        isReadPending = props.isReadPending,
        isSavePending = props.isSavePending,
        readOnly = props.readOnly,
        showDeprecationButtons = props.showDeprecationButtons,
        validationErrors = props.validationErrors,
        onUndeprecateButtonClick = props.onUndeprecateButtonClick,
        onCloneButtonClick = props.onCloneButtonClick,
        onDeprecateButtonClick = props.onDeprecateButtonClick,
        onDeleteButtonClick = props.onDeleteButtonClick,
        onRevertButtonClick = props.onRevertButtonClick,
        onSaveButtonClick = props.onSaveButtonClick,
        onSaveButtonErrorBadgeClick = props.onSaveButtonErrorBadgeClick;


  const className = isReadPending ? _ButtonBar2.default.loading : _ButtonBar2.default.common;

  return _react2.default.createElement(
    'div',
    { className: className },
    _react2.default.createElement(_SaveButton2.default, {
      isModified: isModified,
      isSavePending: isSavePending,
      readOnly: readOnly,
      validationErrors: validationErrors,
      onClick: onSaveButtonClick,
      onErrorBadgeClick: onSaveButtonErrorBadgeClick
    }),
    _react2.default.createElement(_CloneButton2.default, {
      isCloneable: isCloneable,
      isModified: isModified,
      isSavePending: isSavePending,
      onClick: onCloneButtonClick
    }),
    _react2.default.createElement(_RevertButton2.default, {
      isModified: isModified,
      isSavePending: isSavePending,
      readOnly: readOnly,
      onClick: onRevertButtonClick
    }),
    _react2.default.createElement(_DeprecateButton2.default, {
      isDeprecated: isDeprecated,
      isModified: isModified,
      isSavePending: isSavePending,
      readOnly: readOnly,
      showDeprecationButtons: showDeprecationButtons,
      onClick: onDeprecateButtonClick
    }),
    _react2.default.createElement(_UndeprecateButton2.default, {
      isDeprecated: isDeprecated,
      isModified: isModified,
      isSavePending: isSavePending,
      readOnly: readOnly,
      showDeprecationButtons: showDeprecationButtons,
      onClick: onUndeprecateButtonClick
    }),
    _react2.default.createElement(_DeleteButton2.default, {
      isDeletable: isDeletable,
      isSavePending: isSavePending,
      onClick: onDeleteButtonClick
    })
  );
}

RecordButtonBar.propTypes = propTypes;