"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.lernaStatusReducer = void 0;
const lerna_1 = require("../actions/lerna");
const store_1 = require("../store");
const defaultState = {
    lerna: {
        version: null,
        status: 0,
    },
};
exports.lernaStatusReducer = (state = defaultState, action) => {
    switch (action.type) {
        case lerna_1.BUILD_GRAPH:
            return {
                lerna: {
                    version: state.lerna.version,
                    status: store_1.BootstrapStatus.BUILDING_GRAPH,
                },
            };
        case lerna_1.GRAPH_PARSED:
            return {
                lerna: {
                    version: state.lerna.version,
                    status: store_1.BootstrapStatus.BOOTSTRAPPING,
                },
            };
        case lerna_1.GRAPH_BOOTSTRAPPED:
            return {
                lerna: {
                    version: state.lerna.version,
                    status: store_1.BootstrapStatus.SUCCEED,
                },
            };
        case lerna_1.LERNA_ERRORED:
            return {
                lerna: {
                    version: state.lerna.version,
                    status: store_1.BootstrapStatus.ERRORED,
                },
            };
        case lerna_1.UPDATE_LERNA_VERSION:
            return {
                lerna: {
                    version: action.version,
                    status: state.lerna.status,
                },
            };
        default:
            return state;
    }
};
//# sourceMappingURL=lerna.js.map