var AppDispatcher = require('../dispatcher/appDispatcher');
var ItemConstants = require('../constants/itemConstants');

// Define action methods
var ItemActions = {

  loadByCategory: function(categoryId, offset, limit, query) {
    AppDispatcher.handleAction({
      actionType: ItemConstants.LOAD_BY_CATEGORY,
      categoryId : categoryId,
      query : query,
      offset : offset,
      limit: limit
    });
  },

  loadFrontPageItems: function() {
     AppDispatcher.handleAction({
      actionType: ItemConstants.LOAD_FOR_FRONTPAGE
    });
  },

  loadItemWithDetails: function() {
     AppDispatcher.handleAction({
      actionType: ItemConstants.LOAD_ITEM_WITH_DETAILS,
    });
  },

  loadBestSellingItemsForSection: function(sectionId) {
    AppDispatcher.handleAction({
      actionType : ItemConstants.LOAD_BSI_FOR_SECTION,
      sectionId: sectionId
    });
  },

  loadBestSellingItemsForGroup: function(groupId) {
    AppDispatcher.handleAction({
      actionType : ItemConstants.LOAD_BSI_FOR_ITEM_GROUP,
      groupId: groupId
    });
  }
};

module.exports = ItemActions;
