"use strict";

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

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

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

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

var _RecordButtonBar = _interopRequireDefault(require("./RecordButtonBar"));

var _RecordFormSelector = _interopRequireDefault(require("./RecordFormSelector"));

var _RecordHistory = _interopRequireDefault(require("./RecordHistory"));

var _RecordHeader = _interopRequireDefault(require("../../../styles/cspace-ui/RecordHeader.css"));

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

const propTypes = {
  config: _propTypes.default.object,
  data: _propTypes.default.instanceOf(_immutable.default.Map),
  formName: _propTypes.default.string,
  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,
  recordType: _propTypes.default.string.isRequired,
  showDeprecationButtons: _propTypes.default.bool,
  validationErrors: _propTypes.default.instanceOf(_immutable.default.Map),
  onCloneButtonClick: _propTypes.default.func,
  onCommit: _propTypes.default.func,
  onDeprecateButtonClick: _propTypes.default.func,
  onDeleteButtonClick: _propTypes.default.func,
  onRevertButtonClick: _propTypes.default.func,
  onSaveButtonClick: _propTypes.default.func,
  onSaveButtonErrorBadgeClick: _propTypes.default.func,
  onUndeprecateButtonClick: _propTypes.default.func,
  onRunButtonClick: _propTypes.default.func
};

function RecordHeader(props) {
  const {
    config,
    data,
    formName,
    isCloneable,
    isDeletable,
    isDeprecatable,
    isUndeprecatable,
    isModified,
    isReadPending,
    isSavePending,
    isRunnable,
    readOnly,
    recordType,
    showDeprecationButtons,
    validationErrors,
    onCloneButtonClick,
    onCommit,
    onDeprecateButtonClick,
    onDeleteButtonClick,
    onRevertButtonClick,
    onSaveButtonClick,
    onSaveButtonErrorBadgeClick,
    onUndeprecateButtonClick,
    onRunButtonClick
  } = props;
  return _react.default.createElement("div", {
    className: _RecordHeader.default.common
  }, _react.default.createElement(_RecordButtonBar.default, {
    isCloneable: isCloneable,
    isDeletable: isDeletable,
    isDeprecatable: isDeprecatable,
    isRunnable: isRunnable,
    isUndeprecatable: isUndeprecatable,
    isModified: isModified,
    isReadPending: isReadPending,
    isSavePending: isSavePending,
    readOnly: readOnly,
    showDeprecationButtons: showDeprecationButtons,
    validationErrors: validationErrors,
    onCloneButtonClick: onCloneButtonClick,
    onDeprecateButtonClick: onDeprecateButtonClick,
    onDeleteButtonClick: onDeleteButtonClick,
    onRevertButtonClick: onRevertButtonClick,
    onSaveButtonClick: onSaveButtonClick,
    onSaveButtonErrorBadgeClick: onSaveButtonErrorBadgeClick,
    onUndeprecateButtonClick: onUndeprecateButtonClick,
    onRunButtonClick: onRunButtonClick
  }), _react.default.createElement(_RecordFormSelector.default, {
    config: config,
    formName: formName,
    recordType: recordType,
    onCommit: onCommit
  }), _react.default.createElement(_RecordHistory.default, {
    data: data,
    isModified: isModified,
    isSavePending: isSavePending
  }));
}

RecordHeader.propTypes = propTypes;