var AppDispatcher = require('../dispatcher/appDispatcher');
var FilterCriteriaConstants = require('../constants/filterCriteriaConstants');

var FilterCriteriaActions = {
  clearCategoryFilters : function() {
    AppDispatcher.handleAction({
      actionType: FilterCriteriaConstants.CLEAR_CATEGORY_FILTERS
    });
  },
  setAppliedCategoryFilters: function(filters) {
    AppDispatcher.handleAction({
      actionType: FilterCriteriaConstants.SET_APPLIED_CATEGORY_FILTER,
      filters: filters
      });
  },
  addAppliedCategoryFilter: function(name, value) {
    AppDispatcher.handleAction({
      actionType: FilterCriteriaConstants.ADD_APPLIED_CATEGORY_FILTER,
      filter: {
          name: name,
          value: value
        }
      });
  },
  removeAppliedCategoryFilter: function(name) {
    AppDispatcher.handleAction({
      actionType: FilterCriteriaConstants.REMOVE_APPLIED_CATEGORY_FILTER,
      name: name
    });
  }
};

module.exports = FilterCriteriaActions;
