"use strict";

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

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _immutable = _interopRequireDefault(require("immutable"));

var _CloneButton = _interopRequireDefault(require("./CloneButton"));

var _DeleteButton = _interopRequireDefault(require("./DeleteButton"));

var _DeprecateButton = _interopRequireDefault(require("./DeprecateButton"));

var _SaveButton = _interopRequireDefault(require("./SaveButton"));

var _RevertButton = _interopRequireDefault(require("./RevertButton"));

var _RunButton = _interopRequireDefault(require("./RunButton"));

var _UndeprecateButton = _interopRequireDefault(require("./UndeprecateButton"));

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

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

const propTypes = {
  isCloneable: _propTypes.default.bool,
  isDeletable: _propTypes.default.bool,
  isDeprecatable: _propTypes.default.bool,
  isUndeprecatable: _propTypes.default.bool,
  isModified: _propTypes.default.bool,
  isReadPending: _propTypes.default.bool,
  isSavePending: _propTypes.default.bool,
  isRunnable: _propTypes.default.bool,
  readOnly: _propTypes.default.bool,
  validationErrors: _propTypes.default.instanceOf(_immutable.default.Map),
  onUndeprecateButtonClick: _propTypes.default.func,
  onCloneButtonClick: _propTypes.default.func,
  onDeprecateButtonClick: _propTypes.default.func,
  onDeleteButtonClick: _propTypes.default.func,
  onRevertButtonClick: _propTypes.default.func,
  onSaveButtonClick: _propTypes.default.func,
  onSaveButtonErrorBadgeClick: _propTypes.default.func,
  onRunButtonClick: _propTypes.default.func
};

function RecordButtonBar(props) {
  const {
    isCloneable,
    isDeletable,
    isDeprecatable,
    isUndeprecatable,
    isModified,
    isReadPending,
    isSavePending,
    isRunnable,
    readOnly,
    validationErrors,
    onUndeprecateButtonClick,
    onCloneButtonClick,
    onDeprecateButtonClick,
    onDeleteButtonClick,
    onRevertButtonClick,
    onSaveButtonClick,
    onSaveButtonErrorBadgeClick,
    onRunButtonClick
  } = props;
  const className = isReadPending ? _ButtonBar.default.loading : _ButtonBar.default.common;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: className
  }, /*#__PURE__*/_react.default.createElement(_RunButton.default, {
    isModified: isModified,
    isRunnable: isRunnable,
    onClick: onRunButtonClick
  }), /*#__PURE__*/_react.default.createElement(_SaveButton.default, {
    isModified: isModified,
    isSavePending: isSavePending,
    readOnly: readOnly,
    validationErrors: validationErrors,
    onClick: onSaveButtonClick,
    onErrorBadgeClick: onSaveButtonErrorBadgeClick
  }), /*#__PURE__*/_react.default.createElement(_CloneButton.default, {
    isCloneable: isCloneable,
    isModified: isModified,
    isSavePending: isSavePending,
    onClick: onCloneButtonClick
  }), /*#__PURE__*/_react.default.createElement(_RevertButton.default, {
    isModified: isModified,
    isSavePending: isSavePending,
    readOnly: readOnly,
    onClick: onRevertButtonClick
  }), /*#__PURE__*/_react.default.createElement(_DeprecateButton.default, {
    isDeprecatable: isDeprecatable,
    isModified: isModified,
    isSavePending: isSavePending,
    readOnly: readOnly,
    onClick: onDeprecateButtonClick
  }), /*#__PURE__*/_react.default.createElement(_UndeprecateButton.default, {
    isUndeprecatable: isUndeprecatable,
    isModified: isModified,
    isSavePending: isSavePending,
    readOnly: readOnly,
    onClick: onUndeprecateButtonClick
  }), /*#__PURE__*/_react.default.createElement(_DeleteButton.default, {
    isDeletable: isDeletable,
    isSavePending: isSavePending,
    onClick: onDeleteButtonClick
  }));
}

RecordButtonBar.propTypes = propTypes;