'use strict';

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

var _immutable = require('immutable');

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

var addTagAssociations = function addTagAssociations(state, entityType, entityId, tagAssociations) {
  return state.setIn([entityType, entityId], (0, _immutable.fromJS)(tagAssociations));
};

var defaultState = (0, _immutable.fromJS)({});

exports.default = function () {
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
  var action = arguments[1];

  switch (action.type) {
    case _constants.ADD_TAG_ASSOCIATIONS:
      return addTagAssociations(state, action.payload.entityType, action.payload.entityId, action.payload.tagAssociations);
    default:
      return state;
  }
};