package com.red.circle.other.app.inner.endpoint.material.gift;

import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.material.gift.GiftGiveRunningWaterClientService;
import com.red.circle.other.inner.endpoint.material.gift.api.GiftGiveRunningWaterClientApi;
import com.red.circle.other.inner.model.cmd.gift.GiftGiveRunningWaterBackQryCmd;
import com.red.circle.other.inner.model.cmd.gift.GiftStatisticQryCmd;
import com.red.circle.other.inner.model.cmd.gift.SumAnchorTargetQryCmd;
import com.red.circle.other.inner.model.dto.gift.GiftGiveRunningWaterDTO;
import java.math.BigDecimal;
import java.util.List;

import com.red.circle.other.inner.model.dto.gift.GiftStatisticDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 礼物流水.
 *
 * @author pengliang on 2023/8/19
 */
@Validated
@RestController
@RequestMapping(value = GiftGiveRunningWaterClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class GiftGiveRunningWaterClientEndpoint implements GiftGiveRunningWaterClientApi {

  private final GiftGiveRunningWaterClientService giftGiveRunningWaterClientService;

  @Override
  public ResultResponse<Void> updateGiftStatusRefunded(Long sendUserId, Integer startDateNumber,
      Integer endDateNumber) {
    giftGiveRunningWaterClientService.updateGiftStatusRefunded(sendUserId, startDateNumber,
        endDateNumber);
    return ResultResponse.success();
  }


  @Override
  public ResultResponse<List<GiftGiveRunningWaterDTO>> listGiftGiveRunningWater(
      GiftGiveRunningWaterBackQryCmd query) {
    return ResultResponse.success(
        giftGiveRunningWaterClientService.listGiftGiveRunningWater(query));
  }


  @Override
  public ResultResponse<String> sumGiftQuantity(GiftGiveRunningWaterBackQryCmd query) {
    return ResultResponse.success(giftGiveRunningWaterClientService.sumGiftQuantity(query));
  }

  @Override
  public ResultResponse<String> sumGiftValue(GiftGiveRunningWaterBackQryCmd query) {
    return ResultResponse.success(giftGiveRunningWaterClientService.sumGiftValue(query));
  }

  @Override
  public ResultResponse<BigDecimal> sumAnchorTarget(SumAnchorTargetQryCmd query) {
    return ResultResponse.success(giftGiveRunningWaterClientService.sumAnchorTarget(query));
  }

  @Override
  public ResultResponse<BigDecimal> sumAnchorTargetLuckyGift(SumAnchorTargetQryCmd query) {
    return ResultResponse.success(
        giftGiveRunningWaterClientService.sumAnchorTargetLuckyGift(query));
  }

  @Override
  public ResultResponse<List<GiftStatisticDTO>> queryGiftStatistic(GiftStatisticQryCmd query) {
    return ResultResponse.success(giftGiveRunningWaterClientService.queryGiftStatistic(query));
  }
}
