/**
 * 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,
  ProductActionTypes
} from "../types/Product";
import { ThunkAction } from "redux-thunk";
import { AppReduxState } from "../reducers";
import { Action } from "redux";

export function selectProduct(product:any): ThunkAction<void,AppReduxState,null,Action<string>> {
  return (dispatch:any) => {
      dispatch(selectProductDispatch(product)) 
  }
}

function selectProductDispatch(data:any): ProductActionTypes {
  return{
    type: SET_SELECTED_PRODUCT,
    payload: data
  };
}
export function setSeeMoreProducts(product:any): ThunkAction<void,AppReduxState,null,Action<string>> {
  return (dispatch:any) => {
      dispatch(setSeeMoreProductsDispatch(product)) 
  }
}

function setSeeMoreProductsDispatch(data:any): ProductActionTypes {
  return{
    type: SET_SEE_MORE_PRODUCTS,
    payload: data
  };
}
