Subversion Repositories SmartDukaan

Rev

Rev 37276 | 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.util.List;

/**
 * Hot deal ATTRIBUTES.
 *
 * <p>Membership is not managed here any more - a SKU is a hot deal because its brand is
 * {@code ProfitMandiConstants.HOT_DEAL_BRAND}. There is consequently no date window, no
 * "active" notion, and no per-brand cap: the old {@code MAX_ACTIVE_DEALS_PER_BRAND = 15}
 * capped deals per OEM, which is meaningless once every hot deal shares one brand.
 *
 * <p>What remains is the five per-SKU pill attributes the partner app renders.
 */
public interface ModelHotDealService {

    /** Attributes for one Hot Deal SKU, or null when ops has not filled them in yet. */
    ModelHotDeal getAttributes(int catalogItemId);

    /** All attribute rows, newest first, server-side searched and paginated. */
    List<ModelHotDeal> listAll(String query, int page, int pageSize);

    long countDeals(String query);

    /**
     * Create or update the five pill attributes for a Hot Deal-brand catalog.
     * Rejects any catalog that does not carry the brand.
     *
     * @param oemCatalogId optional channel-side counterpart under the model's OEM brand;
     *                     null clears any existing mapping. Validated to exist and to
     *                     actually belong to that OEM brand.
     */
    void saveAttributes(int catalogItemId, HotDealAttributes attributes, Integer oemCatalogId, String user)
            throws ProfitMandiBusinessException;

    /** Drop the attributes row. The SKU stays a hot deal - only its pills disappear. */
    void removeAttributes(int id) throws ProfitMandiBusinessException;
}