Subversion Repositories SmartDukaan

Rev

Rev 36374 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.service.offers;

import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
import com.spice.profitmandi.dao.entity.catalog.Offer;
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
import com.spice.profitmandi.dao.model.AmountModel;
import com.spice.profitmandi.dao.model.CreateOfferRequest;
import com.spice.profitmandi.dao.model.QtyAmountModel;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.springframework.stereotype.Service;

import java.io.InputStream;
import java.time.LocalDate;
import java.time.YearMonth;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.LinkedHashMap;

@Service
public interface OfferService {
        void evictOfferCaches(int offerId);

        void evictOfferDefinitionCache(int offerId);

        Set<Integer> getMonthOfferIds(YearMonth yearMonth) throws ProfitMandiBusinessException;

        void addOfferService(CreateOfferRequest createOfferRequest) throws ProfitMandiBusinessException;

    List<CreateOfferRequest> getPublishedOffers(int fofoId, YearMonth yearMonth) throws ProfitMandiBusinessException;

    List<CreateOfferRequest> getPublishedOffersCached(int fofoId, YearMonth yearMonth) throws ProfitMandiBusinessException;

    Map<Integer, CreateOfferRequest> getAllOffers(YearMonth yearMonth) throws ProfitMandiBusinessException;

    CreateOfferRequest getOfferDefinition(int offerId) throws ProfitMandiBusinessException;

    CreateOfferRequest getOffer(int fofoId, int offerId) throws ProfitMandiBusinessException;

    List<CreateOfferRequest> getPublishedOffers(LocalDate date, int fofoId, int catalogId) throws ProfitMandiBusinessException;

    Map<Integer, CreateOfferRequest> getPublishedOffers(LocalDate date, int fofoId, String brand);

    List<CreateOfferRequest> getActiveOffers(int fofoId) throws ProfitMandiBusinessException;

    void createOffers(InputStream inputStream) throws Exception;

    Map<Integer, Map<Integer, Long>> getSlabPayoutMap(CreateOfferRequest createOfferRequest) throws ProfitMandiBusinessException;


    Map<Integer, Map<Integer, AmountModel>> getSlabPayoutMapNew(CreateOfferRequest createOfferRequest);

    CreateOfferRequest getCreateOfferRequest(Offer fromOffer) throws ProfitMandiBusinessException;

    void reverseAdditionalSelloutSchemes(List<InventoryItem> inventoryItems, String reversalReason) throws ProfitMandiBusinessException;

    void restoreAdditionalSelloutSchemes(List<InventoryItem> inventoryItems, String restoreReason) throws ProfitMandiBusinessException;

    void processSellin(CreateOfferRequest createOfferRequest) throws Exception;

    Map<Integer, QtyAmountModel> getCriteriaQtyAmounModelMap(CreateOfferRequest createOfferRequest, int fofoId) throws ProfitMandiBusinessException;

    void processActivationtOffer(CreateOfferRequest createOfferRequest) throws ProfitMandiBusinessException;

    /**
     * Read-only calculation of offer payouts per partner. Returns a list of payout data
     * without persisting anything. Used by batch processing to separate read from write.
     */
    List<OfferPartnerPayoutData> calculateOfferPayouts(CreateOfferRequest createOfferRequest) throws ProfitMandiBusinessException;

    List<SellinPartnerPayoutData> calculateSellinPayouts(CreateOfferRequest createOfferRequest) throws Exception;

    String getPartnerCriteriaString(PartnerCriteria partnerCriteria) throws ProfitMandiBusinessException;

    ByteArrayOutputStream createCSVOfferReport(CreateOfferRequest createOfferRequest) throws Exception;

    void sendWhatsapp(Offer offer, List<Integer> fofoIds, String imageUrl) throws Exception;

    void deleteOffer(int offerId) throws ProfitMandiBusinessException;

    List<Offer> publishAllUnpublished(YearMonth yearMonth) throws ProfitMandiBusinessException;

    void removePartnersFromOffer(int offerId, List<Integer> fofoIds) throws ProfitMandiBusinessException;

    void addPartnersToOffer(int offerId, List<Integer> fofoIds) throws ProfitMandiBusinessException;

    int cloneOfferForPartners(int sourceOfferId, List<Integer> fofoIds, List<Integer> targets) throws ProfitMandiBusinessException;

    void updateOfferTargets(int offerId, List<Integer> newTargets) throws ProfitMandiBusinessException;

    void updateOfferSlabs(com.spice.profitmandi.dao.model.UpdateOfferSlabsRequest request) throws ProfitMandiBusinessException;
}