"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.get = exports.default = void 0;
var _immutable = _interopRequireDefault(require("immutable"));
var _actionCodes = require("../constants/actionCodes");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = function _default() {
  let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _immutable.default.Map();
  let action = arguments.length > 1 ? arguments[1] : undefined;
  switch (action.type) {
    case _actionCodes.ADD_OPTION_LISTS:
      return Object.keys(action.payload).reduce((newState, key) => newState.set(key, action.payload[key]), state);
    case _actionCodes.DELETE_OPTION_LIST:
      return state.delete(action.payload);
    default:
      return state;
  }
};
exports.default = _default;
const get = (state, optionListName) => state.get(optionListName);
exports.get = get;