const actions = require('./actions');

const defaultAccount = null;
function accountReducer(state = defaultAccount, action) {
    switch (action.type) {
        case actions.SET_ACCOUNT:
            return action.value;
        default:
            return state;
    }
}

const defaultActiveSkill = null;
function activeSkillReducer(state = defaultActiveSkill, action) {
    switch (action.type) {
        case actions.SET_ACTIVE_SKILL:
            return action.value;
        default:
            return state;
    }
}

const defaultCryps = null;
function crypsReducer(state = defaultCryps, action) {
    switch (action.type) {
        case actions.SET_CRYPS:
            return action.value;
        default:
            return state;
    }
}

const defaultInstances = null;
function instancesReducer(state = defaultInstances, action) {
    switch (action.type) {
        case actions.SET_INSTANCES:
            return action.value;
        default:
            return state;
    }
}

const defaultInstance = null;
function instanceReducer(state = defaultInstance, action) {
    switch (action.type) {
        case actions.SET_INSTANCE:
            return action.value;
        default:
            return state;
    }
}

const defaultSelectedCryps = [null, null, null];
function selectedCrypsReducer(state = defaultSelectedCryps, action) {
    switch (action.type) {
        case actions.SET_SELECTED_CRYPS:
            return action.value;
        default:
            return state;
    }
}

const defaultCombiner = [null, null, null];
function combinerReducer(state = defaultCombiner, action) {
    switch (action.type) {
        case actions.SET_COMBINER:
            return action.value;
        default:
            return state;
    }
}

const defaultGame = null;
function gameReducer(state = defaultGame, action) {
    switch (action.type) {
        case actions.SET_GAME:
            return action.value;
        default:
            return state;
    }
}

const defaultReclaiming = false;
function reclaimingReducer(state = defaultReclaiming, action) {
    switch (action.type) {
        case actions.SET_RECLAIMING:
            return action.value;
        default:
            return state;
    }
}

const defaultWs = null;
function wsReducer(state = defaultWs, action) {
    switch (action.type) {
        case actions.SET_WS:
            return action.value;
        default:
            return state;
    }
}

const defaultInfo = null;
function infoReducer(state = defaultInfo, action) {
    switch (action.type) {
        case actions.SET_INFO:
            return action.value;
        default:
            return state;
    }
}

module.exports = {
    accountReducer,
    activeSkillReducer,
    combinerReducer,
    crypsReducer,
    gameReducer,
    instanceReducer,
    instancesReducer,
    reclaimingReducer,
    selectedCrypsReducer,
    wsReducer,
    infoReducer,
};
