/**
 * React Native Full App (https://store.enappd.com/product/react-native-full-app)
 *
 * Copyright © 2019-present Enappd. All rights reserved.
 *
 * This source code is licensed as per the terms found in the
 * LICENSE.md file in the root directory of this source tree.
 */

import {
  SET_SELECTED_PRODUCT,
  SET_SEE_MORE_PRODUCTS,
} from "../types/Product";

const INITIAL_STATE: ProductReducerState = {
    selectedProduct: {},
    seeMoreProductList: [],
  };

interface ProductReducerState {
  selectedProduct: any;
  seeMoreProductList: Array<any>;
}
  
  export default function (state = INITIAL_STATE, action:any): ProductReducerState {
    switch (action.type) {
      case SET_SELECTED_PRODUCT:
        return { ...state, selectedProduct: action.payload };
      case SET_SEE_MORE_PRODUCTS:
        return { ...state, seeMoreProductList: action.payload };
      default :
        return state
    }
  };