"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.addOptionLists = void 0;

var _actionCodes = require("../constants/actionCodes");

const addOptionLists = optionLists => {
  const mergedOptionLists = {};
  Object.keys(optionLists).forEach(optionListName => {
    const {
      values,
      messages
    } = optionLists[optionListName];
    mergedOptionLists[optionListName] = values.map(value => {
      const merged = {
        value
      };
      const message = messages && messages[value];

      if (message) {
        merged.message = message;
      }

      return merged;
    });
  });
  return {
    type: _actionCodes.ADD_OPTION_LISTS,
    payload: mergedOptionLists
  };
};

exports.addOptionLists = addOptionLists;
var _default = {};
exports.default = _default;