'use strict';

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

var addOptionLists = exports.addOptionLists = function addOptionLists(optionLists) {
  var mergedOptionLists = {};

  Object.keys(optionLists).forEach(function (optionListName) {
    var _optionLists$optionLi = optionLists[optionListName],
        values = _optionLists$optionLi.values,
        messages = _optionLists$optionLi.messages;


    mergedOptionLists[optionListName] = values.map(function (value) {
      var merged = {
        value: value
      };

      if (messages && messages[value]) {
        merged.message = messages[value];
      }

      return merged;
    });
  });

  return {
    type: ADD_OPTION_LISTS,
    payload: mergedOptionLists
  };
};