export function focusedPathReducer(state, action) {
    switch(action.type){
        case 'reset':
            {
                return [];
            }
        case 'set_focus':
            {
                return action.value;
            }
        case 'set_initial_focus':
            {
                return [
                    0
                ];
            }
        case 'change_last_focus':
            {
                return [
                    ...state.slice(0, -1),
                    action.value
                ];
            }
        case 'add_focus':
            {
                return [
                    ...state,
                    action.value
                ];
            }
        case 'return_prev_focus':
            {
                if (state.length === 1) {
                    return state;
                }
                return state.slice(0, -1);
            }
        default:
            {
                return state;
            }
    }
}
