/*
 * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.yami.shop.discount.comment.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.app.dto.DiscountDto;
import com.yami.shop.bean.app.dto.ProductDto;
import com.yami.shop.bean.model.Product;
import com.yami.shop.bean.param.OfflineHandleEventAuditParam;
import com.yami.shop.bean.param.ProductParam;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.discount.comment.model.Discount;

import javax.validation.Valid;
import java.util.List;

/**
 * @author lgh on 2018/11/21.
 */
public interface DiscountService extends IService<Discount> {

    void insertDiscountAndItemAndProd(@Valid Discount discount);

    void updateDiscountAndItemAndProd(@Valid Discount discount);

    void deleteDiscountsAndItemsAndProds(Long id, Long discountId);

    Discount getDiscountAndItemAndProdById(Long discountId);

    void removeDiscountAndItemAndProdCacheById(Long discountId);

    List<Discount> listDiscountsAndItemsByShopId(Long shopId);

    void removeDiscountsAndItemsCacheByShopId(Long shopId);

    List<DiscountDto> listByProdId(Long prodId, Long shopId);

    IPage<ProductDto> discountProdList(PageParam<ProductDto> page,Long discountId);

    /**
     * 分页获取平台满减数据
     */
    IPage<Discount> getPlatformDiscountPage(PageParam<Discount> page, Discount discount);

    /**
     * 平台 --下线活动
     */
    void offline(Discount discount, String offlineReason, Long sysUserId);

    /**
     * 商家 --申请活动
     */
    void auditApply(Long eventId, Long discountId, String reapplyReason);

    /**
     * 平台 --审核活动
     *
     */
    void auditDiscount(OfflineHandleEventAuditParam offlineHandleEventAuditParam, Long sysUserId);

    IPage<DiscountDto> getDiscountList(PageParam<Discount> page);

    DiscountDto getDiscountByDiscountId(Long discountId);

    void closeDiscountBySetStatus();

    Integer countProdIsSeckillAll(Long shopId, Long prodId);

    Integer countProdIsSeckillSome(Long shopId, Long prodId);

    Integer countProdIsSeckillExcept(Long shopId, Long prodId);

    List<Long> getProdIsSeckillExcept(Long shopId);

    IPage<Product> pageProdByDiscount(PageParam<Product> page, ProductParam product, Discount discount);
}
