Subversion Repositories SmartDukaan

Rev

Rev 37254 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.service.catalog;

import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
import com.spice.profitmandi.dao.entity.catalog.ModelHotDeal;

import java.time.LocalDate;
import java.util.List;

public interface ModelHotDealService {

    int MAX_ACTIVE_DEALS_PER_BRAND = 15;

    List<ModelHotDeal> getDealsForBrand(int brandId);

    /** All deals across brands, newest window first, server-side searched + paginated. */
    List<ModelHotDeal> searchDeals(String query, int page, int pageSize);

    long countDeals(String query);

    long countActive(int brandId);

    void addDeal(int brandId, int catalogItemId, LocalDate startDate, LocalDate endDate,
                 HotDealAttributes attributes, String user) throws ProfitMandiBusinessException;

    void updateDeal(int id, LocalDate startDate, LocalDate endDate,
                    HotDealAttributes attributes, String user) throws ProfitMandiBusinessException;

    void removeDeal(int id) throws ProfitMandiBusinessException;

    /**
     * Re-index the models whose deal window opens today or closed yesterday, so Solr's
     * derived hot_deal_b follows the window without anyone editing the deal. Run daily.
     */
    void syncHotDealFlags();
}