'use strict';

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

var _reactRedux = require('react-redux');

var _RelatedRecordPanel = require('../../components/record/RelatedRecordPanel');

var _RelatedRecordPanel2 = _interopRequireDefault(_RelatedRecordPanel);

var _notification = require('../../actions/notification');

var _relation = require('../../actions/relation');

var _search = require('../../actions/search');

var _reducers = require('../../reducers');

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

var mapStateToProps = function mapStateToProps(state, ownProps) {
  var csid = ownProps.csid,
      name = ownProps.name;


  return {
    openModalName: (0, _reducers.getOpenModalName)(state),
    perms: (0, _reducers.getUserPerms)(state),
    recordData: (0, _reducers.getRecordData)(state, csid),
    recordRelationUpdatedTimestamp: (0, _reducers.getRecordRelationUpdatedTimestamp)(state, csid),
    selectedItems: (0, _reducers.getSearchSelectedItems)(state, name)
  };
};

var mapDispatchToProps = {
  clearSelected: _search.clearSelected,
  closeModal: _notification.closeModal,
  openModal: _notification.openModal,
  onItemSelectChange: _search.setResultItemSelected,
  setAllItemsSelected: _search.setAllResultItemsSelected,
  unrelateRecords: _relation.batchUnrelateBidirectional
};

exports.default = (0, _reactRedux.connect)(mapStateToProps, mapDispatchToProps)(_RelatedRecordPanel2.default);