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

import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.common.business.dto.cmd.app.AppTypeCmd;
import com.red.circle.other.app.dto.clientobject.activity.RoomProfileCO;
import com.red.circle.other.app.service.activity.RoomFanVotesActivityService;
import com.red.circle.other.inner.model.dto.activity.props.ActivityRewardProps;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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 lisizhe on 2023/9/25
 * @eo.api-type http
 * @eo.groupName 活动服务.房间粉丝人气票活动
 * @eo.path /activity/room/fan/votes
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/activity/room/fan/votes", produces = MediaType.APPLICATION_JSON_VALUE)
public class RoomFanVotesActivityRestController {

  private final RoomFanVotesActivityService roomFanVotesActivityService;

  /**
   * 房间榜单列表.
   *
   * @eo.name 房间榜单列表
   * @eo.url /room/list
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/room/list")
  public List<RoomProfileCO> listRoom(AppTypeCmd cmd) {
    return roomFanVotesActivityService.listRoom(cmd);
  }

  /**
   * 活动奖励池.
   *
   * @eo.name 活动奖励池
   * @eo.url /reward/pool
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/reward/pool")
  public List<List<ActivityRewardProps>> listRewardPool(AppExtCommand cmd) {
    return roomFanVotesActivityService.listRewardPool(cmd);
  }

  /**
   * 倒计时.
   *
   * @eo.name 倒计时
   * @eo.url /countdown
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/countdown")
  public Long getCountdown(AppExtCommand cmd) {
    return roomFanVotesActivityService.getCountdown(cmd);
  }

  /**
   * 获取活动状态：true已开始 false已结束.
   *
   * @eo.name 获取活动状态
   * @eo.url /status
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/status")
  public Boolean getActivityStatus(AppExtCommand cmd) {
    return roomFanVotesActivityService.getActivityStatus(cmd);
  }

}
