Subversion Repositories SmartDukaan

Rev

Rev 37244 | Rev 37276 | 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;

    /**
     * Reconcile catalog.tag_listing.hot_deals with the date-windowed model_hot_deal
     * source of truth (Solr's hot_deal_b reads that flag): models with an active deal
     * get flagged, everything else unflagged. Run daily so windows start/expire on time.
     */
    void syncHotDealFlags();
}