'use strict';

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

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

var _immutable = require('immutable');

var _immutable2 = _interopRequireDefault(_immutable);

var _refNameHelpers = require('../../../src/helpers/refNameHelpers');

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

var _record = require('../../actions/record');

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

var _HierarchyReparentNotifier = require('../../components/record/HierarchyReparentNotifier');

var _HierarchyReparentNotifier2 = _interopRequireDefault(_HierarchyReparentNotifier);

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

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


  return {
    childData: _immutable2.default.Map(childRefNames.map(function (refName) {
      return [refName, (0, _reducers.getRecordData)(state, (0, _refNameHelpers.refNameToCsid)(refName))];
    }))
  };
};

var mapDispatchToProps = {
  readRecord: _record.readRecord,
  removeNotification: _notification.removeNotification,
  showNotification: _notification.showNotification
};

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