/*!
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
import {actionTypes, enums} from './OnboardingConstants.js';

export const currentScreenReducer = (state = {forceBreadCrumbsUpdate: false, screen: enums.SCREEN.ONBOARDING_CATALOG, props: {}}, action) => {
	switch (action.type) {
		case actionTypes.SET_CURRENT_SCREEN: 
			return action.currentScreen;
		case actionTypes.SET_CURRENT_SCREEN_VERSION:
			return {
				...state,
				props: {
					...state.props,
					version: action.version
				}
			};	
		default:
			return state;
	}	
};

