"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setDatum = exports.removeDatum = exports.setData = exports.removeData = exports.defaultState = void 0;
const f_1 = require("../../system/core/object/DissocAll/f");
const f_2 = require("../../system/core/object/DissocPath/f");
const f_3 = require("../../system/f/object/Merge/f");
const f_4 = require("../../system/f/object/Set/f");
const data_1 = require("../actions/data");
exports.defaultState = {};
const removeData = ({ ids }, state) => {
    return (0, f_1.default)(state, ids);
};
exports.removeData = removeData;
const setData = ({ data }, state) => {
    return (0, f_3.default)(state, data);
};
exports.setData = setData;
const removeDatum = ({ id }, state) => {
    return (0, f_2.default)(state, [id]);
};
exports.removeDatum = removeDatum;
const setDatum = ({ id, value }, state) => {
    return (0, f_4.default)(state, id, value);
};
exports.setDatum = setDatum;
function default_1(state = exports.defaultState, { type, data }) {
    switch (type) {
        case data_1.SET_DATUM:
            return (0, exports.setDatum)(data, state);
        case data_1.SET_DATA:
            return (0, exports.setData)(data, state);
        case data_1.REMOVE_DATUM:
            return (0, exports.removeDatum)(data, state);
        case data_1.REMOVE_DATA:
            return (0, exports.removeData)(data, state);
        default:
            return state;
    }
}
exports.default = default_1;
//# sourceMappingURL=data.js.map