import { ADD_ALL_DECKS_TO_CART, ADD_DECK_TO_CART, REMOVE_DECK_FROM_CART } from '../constants/cart';

export function addDeckToCart(deck) {
  return {
    type: ADD_DECK_TO_CART,
    payload: { deck }
  };
}

export function removeDeckFromCart(deckId) {
  return {
    type: REMOVE_DECK_FROM_CART,
    payload: { deckId }
  };
}

export function addAllDecksToCart() {
  return function (dispatch, getState) {
    return dispatch({
      type: ADD_ALL_DECKS_TO_CART,
      payload: { decks: getState().decks.data }
    });
  };
}
