import { HYDRATE } from 'next-redux-wrapper';

import * as actionTypes from '../constants/actionTypes';
import initialState from "./initialState";

const contractsInfoReducer = (state = initialState.contracts_info, action) => 
{
	switch (action.type) 
	{
		case HYDRATE: 
		{
			return { 
				...state, 
				...action.payload.contracts_info, 
			};
		}

		case actionTypes.CONTRACTS_INFO: 
		{
			return {
				...state, ...action.data, 
			};
		}

		case actionTypes.CONTRACTS_INFO_RESET: 
		{
			return {};
		}

		default: {
			return state;
		}
	}
};

export default contractsInfoReducer;