package com.red.circle.other.adapter.app.activity.room;

import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardCO;
import com.red.circle.other.app.dto.clientobject.activity.ActivityLeaderboardListCO;
import com.red.circle.other.app.service.activity.ActivityLeaderboardService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 排行榜.
 *
 * @author pengliang on 2021/2/24
 * @eo.api-type http
 * @eo.groupName 活动服务.排行榜
 * @eo.path /activity/leaderboard
 */
@RestController
@RequestMapping(value = "/activity/leaderboard", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class ActivityLeaderboardRestController {

  private final ActivityLeaderboardService activityLeaderboardService;

  /**
   * 房间礼物排行榜.
   *
   * @eo.name 房间礼物排行榜.
   * @eo.url /room-gifts
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/room-gifts")
  public ActivityLeaderboardCO roomGiftsLeaderboard(AppExtCommand cmd) {
    return activityLeaderboardService.roomGiftsLeaderboard(cmd);
  }

  /**
   * 礼物赠送排行榜.
   *
   * @eo.name 礼物赠送排行榜.
   * @eo.url /gifts-send
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/gifts-send")
  public ActivityLeaderboardCO giftsSendLeaderboard(AppExtCommand cmd) {
    return activityLeaderboardService.giftsSendLeaderboard(cmd);
  }

  /**
   * 礼物接收排行榜.
   *
   * @eo.name 礼物接收排行榜.
   * @eo.url /gifts-received
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/gifts-received")
  public ActivityLeaderboardCO giftsReceivedLeaderboard(AppExtCommand cmd) {
    return activityLeaderboardService.giftsReceivedLeaderboard(cmd);
  }

  /**
   * 充值排行榜.
   *
   * @eo.name 充值排行榜.
   * @eo.url /recharge
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/recharge")
  public ActivityLeaderboardCO rechargeLeaderboard(AppExtCommand cmd) {
    return activityLeaderboardService.rechargeLeaderboard(cmd);
  }

  /**
   * app使用查询前三名
   * @param cmd
   * @return
   */
  @GetMapping("/appLeaderboard")
  public ActivityLeaderboardListCO getAppLeaderboard(AppExtCommand cmd){

    return activityLeaderboardService.getAppLeaderboard(cmd);
  }

  /**
   * 我的排名.
   *
   * @eo.name 我的排名.
   * @eo.url /my-rank
   * @eo.method get
   * @eo.request-type formdata
   * @eo.param type 类型 (ROOM_GIFTS:房间礼物, GIFTS_SEND:礼物赠送, GIFTS_RECEIVED:礼物接收)
   * @eo.param dateType 时间类型 (HOUR:小时, DAY:天, WEEK:周, MONTH:月)
   */
  @GetMapping("/my-rank")
  public ActivityLeaderboardCO.LeaderboardUserCO myRank(AppExtCommand cmd, String type, String dateType) {
    return activityLeaderboardService.myRank(cmd, type, dateType);
  }

}
