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 defaultActiveVar = null;
function activeVarReducer(state = defaultActiveVar, action) {
    switch (action.type) {
        case actions.SET_ACTIVE_VAR:
            return action.value;
        default:
            return state;
    }
}

const defaultActiveCryp = null;
function activeCrypReducer(state = defaultActiveCryp, action) {
    switch (action.type) {
        case actions.SET_ACTIVE_CRYP:
            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 defaultPlayer = null;
function playerReducer(state = defaultPlayer, action) {
    switch (action.type) {
        case actions.SET_PLAYER:
            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 defaultResolution = null;
function resolutionReducer(state = defaultResolution, action) {
    switch (action.type) {
        case actions.SET_RESOLUTION:
            return action.value;
        default:
            return state;
    }
}

const defaultShowLog = false;
function showLogReducer(state = defaultShowLog, action) {
    switch (action.type) {
        case actions.SET_SHOW_LOG:
            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, null];
function infoReducer(state = defaultInfo, action) {
    switch (action.type) {
        case actions.SET_INFO:
            return action.value;
        default:
            return state;
    }
}

module.exports = {
    accountReducer,
    activeSkillReducer,
    activeCrypReducer,
    activeVarReducer,
    combinerReducer,
    crypsReducer,
    gameReducer,
    showLogReducer,
    instanceReducer,
    instancesReducer,
    playerReducer,
    reclaimingReducer,
    selectedCrypsReducer,
    resolutionReducer,
    wsReducer,
    infoReducer,
};
