"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
        s = arguments[i];
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
            t[p] = s[p];
    }
    return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("../util/util");
function baseReducer(state, action) {
    switch (action.type) {
        case 'CONFIG_LOADING':
            return __assign({}, state, { isLoading: true, timestamp: util_1.Util.getTimeStamp() });
        case 'CONFIG_LOADED':
            var newState_1 = __assign({}, state, { isLoading: false });
            Object.keys(action.payload).forEach(function (k) {
                newState_1[k] = action.payload[k];
            });
            newState_1.timestamp = util_1.Util.getTimeStamp();
            return newState_1;
        case 'SET_CONFIG':
            var newConfig_1 = __assign({}, state);
            Object.keys(action.payload).forEach(function (k) {
                newConfig_1[k] = action.payload[k];
            });
            newConfig_1.timestamp = util_1.Util.getTimeStamp();
            return newConfig_1;
        default:
            return state;
    }
}
exports.default = baseReducer;
//# sourceMappingURL=base-reducer.js.map