package com.red.circle.other.infra.database.rds.dao.rocket;

import com.red.circle.other.infra.database.rds.entity.RocketRewardClaimLogEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 火箭奖励领取记录Mapper
 *
 * @author system
 * @date 2025-01-15
 */
public interface RocketRewardClaimLogDAO {

    /**
     * 插入
     */
    int insert(RocketRewardClaimLogEntity entity);

    /**
     * 检查是否已领取
     */
    int countByRocketAndUser(@Param("rocketHistoryId") String rocketHistoryId,
                              @Param("userId") Long userId);

    /**
     * 检查用户是否已领取（带等级）
     */
    int countByRoomAndUserAndDateAndLevel(@Param("userId") Long userId,
                                          @Param("roomId") Long roomId,
                                          @Param("date") String date,
                                          @Param("level") Integer level);

    /**
     * 根据火箭历史ID查询
     */
    List<RocketRewardClaimLogEntity> selectByRocketHistoryId(@Param("rocketHistoryId") String rocketHistoryId);

    /**
     * 根据房间ID和用户ID查询
     */
    List<RocketRewardClaimLogEntity> selectByRoomIdAndUserId(@Param("roomId") Long roomId,
                                                               @Param("userId") Long userId);

    /**
     * 统计某次发射的领取人数
     */
    int countByRocketHistoryId(@Param("rocketHistoryId") String rocketHistoryId);
}
