package com.yonge.cooleshow.biz.dal.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yonge.cooleshow.auth.api.entity.SysUser;
import com.yonge.cooleshow.biz.dal.dto.ActivityRewardDto;
import com.yonge.cooleshow.biz.dal.dto.search.ActivityRewardChangeStockSearch;
import com.yonge.cooleshow.biz.dal.entity.ActivityRewardChangeStock;
import com.yonge.cooleshow.biz.dal.vo.ActivityRewardChangeStockVo;
import com.yonge.cooleshow.biz.dal.vo.ActivityRewardVo;
import com.yonge.cooleshow.biz.dal.dto.search.ActivityRewardSearch;
import com.yonge.cooleshow.biz.dal.entity.ActivityReward;

import java.util.Date;
import java.util.List;

/**
 * 活动奖品表 服务类
 * @author liweifan
 * @date 2022-08-04
 */
public interface ActivityRewardService extends IService<ActivityReward>  {

	/**
     * 查询详情
     * @author liweifan
 	 * @date 2022-08-04
     */
	ActivityRewardVo detail(Long id);
	/**
	 * 通过活动id查询详情
	 * @author liweifan
	 * @date 2022-08-04
	 */
	ActivityRewardVo detailByActivityId(Long id);

	/**
     * 分页查询
     * @author liweifan
 	 * @date 2022-08-04
     */
    IPage<ActivityRewardVo> selectPage(IPage<ActivityRewardVo> page, ActivityRewardSearch query);

	/**
	 * 列表查询
	 * @author liweifan
	 * @date 2022-08-04
	 */
	List<ActivityRewardVo> selectAll(ActivityRewardSearch query);

	Boolean submit(ActivityRewardDto activityReward, SysUser user);

	/**
	 * 获取活动所有奖品
	 *
	 * @param activityPlanId 活动id
	 * @return
	 */
    List<ActivityReward> getActivityReward(Long activityPlanId);

	/**
	 * 启用/停用
	 * @param id
	 * @param status
	 * @param userId
	 * @return
	 */
    Boolean updateStatus(Long id, Integer status, Long userId);

	/**
	 * 调整库存
	 * @param activityRewardChangeStock
	 * @return
	 */
	Boolean updateStock(ActivityRewardChangeStock activityRewardChangeStock);

	/**
	 * 库存变更记录查询分页
	 * @param page
	 * @param query
	 * @return
	 */
	IPage<ActivityRewardChangeStockVo> selectChangeStockPage(IPage<ActivityRewardChangeStockVo> page, ActivityRewardChangeStockSearch query);

	/**
	 * 发放获奖奖品 记录
	 * @param userId 用户id
	 * @param activityId 活动id
	 * @param activityRewardIds 活动关联奖品ID
	 * @param date
	 * @return 返回发放成功奖品id
	 */
	List<Long> sendReward(Long userId, Long activityId, List<Long> activityRewardIds, Date date);

	/**
	 * 领取奖品
	 *
	 * @param userId 用户id
	 * @param date 领取时间
	 * @param activityPlanId 活动id
	 * @param activityRewardId 奖品id
	 */
    void receiveReward(Long userId, Date date, Long activityPlanId, Long activityRewardId);

    Boolean userRewarded(Long userId, Long activityId);
}