'use strict';

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

var _immutable = require('immutable');

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

var _banks = require('../../../../banks/api/banks');

var _presenter = require('./presenter');

var _presenter2 = _interopRequireDefault(_presenter);

var _Bank = require('../../../records/Bank');

var _Bank2 = _interopRequireDefault(_Bank);

var _ui = require('../../../actions/ui');

var _constants = require('../../../../constants');

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

function mapStateToProps(state, props) {
  var banks = state.getIn(['ui', _constants.SELECT_BANKS_OPTIONS], (0, _immutable.List)()).map(function (bankId) {
    return new _Bank2.default(state.getIn(['banks', bankId]));
  });
  return {
    banks: banks
  };
}

exports.default = (0, _reactRedux.connect)(mapStateToProps, {
  getAllBanks: _banks.getAllBanks,
  setUi: _ui.set
})(_presenter2.default);