package com.red.circle.other.infra.database.mongo.service.gift;

import com.red.circle.other.infra.database.mongo.dto.CountExclusiveGift;
import com.red.circle.other.infra.database.mongo.dto.RoomActiveIndexDTO;
import com.red.circle.other.infra.database.mongo.dto.query.GiftGiveRunningWaterQuery;
import com.red.circle.other.infra.database.mongo.dto.query.NewSumAnchorTargetQuery;
import com.red.circle.other.infra.database.mongo.entity.gift.GiftGiveRunningWater;
import com.red.circle.other.inner.model.cmd.gift.SumAnchorTargetQryCmd;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 礼物流水.
 *
 * @author pengliang on 2022/7/25
 */
public interface GiftGiveRunningWaterService {

  @Deprecated
  void removeById(Long id);

  /**
   * 添加流水.
   */
  Boolean add(GiftGiveRunningWater runningWater);

  /**
   * 根据ID获取记录.
   */
  GiftGiveRunningWater getByIdPrimary(Long id);

  /**
   * 添加日志.
   */
  void addLog(Long id, String content);

  /**
   * 查询流水信息.
   */
  List<GiftGiveRunningWater> list(GiftGiveRunningWaterQuery query);

  @Deprecated
  List<GiftGiveRunningWater> listActivityDouble(List<Long> giftIds, Timestamp startTime,
      Long lastId);

  /**
   * 获取本月，没有统计的主播目标.
   */
  List<GiftGiveRunningWater> listThisMonthAnchorNotCountTarget(Integer limit);

  /**
   * 统计礼物价值-count.
   */
  String sumGiftValue(GiftGiveRunningWaterQuery query);

  /**
   * 统计礼物数量-count.
   */
  String sumGiftQuantity(GiftGiveRunningWaterQuery query);

  /**
   * 修改接收用户单据id.
   */
  void updateAcceptUserReceiptId(Long id, Long acceptUserId, Long receiptId);

  /**
   * 标记状态已被统计.
   */
  void updateAcceptUserCountTargetAmountTrue(Long id, Long countBillId, Long acceptUserId);

  /**
   * 获取最近房间贡献用户.
   */
  List<Long> listLatestRoomContributionUserIs(Long roomId, Timestamp startTime,
      Integer size);

  /**
   * 房间活跃指标统计.
   */
  RoomActiveIndexDTO countRoomActiveIndex(Long roomId, Timestamp startTime,
      Timestamp endTime);

  /**
   * 统计专属礼物.
   */
  List<CountExclusiveGift> countExclusiveGift(Integer start, Integer end);

  /**
   * 恢复主播目标.
   */
  BigDecimal sumAnchorTarget(SumAnchorTargetQryCmd query);

  /**
   * 恢复主播目标.
   */
  BigDecimal sumAnchorTarget(NewSumAnchorTargetQuery query);

  /**
   * 恢复主播幸运礼物目标.
   */
  BigDecimal sumAnchorTargetLuckyGift(SumAnchorTargetQryCmd query);

  /**
   * 发送人的礼物状态为已退款.
   *
   * @param sendUserId      发送用户ID
   * @param startDateNumber 开始时间段
   * @param endDateNumber   结束时间段
   */
  void updateGiftStatusRefunded(Long sendUserId, Integer startDateNumber, Integer endDateNumber);

  /**
   * 统计范围贡献.
   */
  BigDecimal countRoomContribution(Long roomId, Integer startDate, Integer endDate);

  /**
   * 根据trackId 获取是否存在.
   */
  List<String> listByTrackId(List<String> trackIds);

  List<GiftGiveRunningWater> listLatest(LocalDateTime startTime);
}
