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


import com.red.circle.common.business.dto.cmd.AppExtCommand;
import com.red.circle.common.business.dto.cmd.LastIdCmd;
import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.app.dto.clientobject.game.GameLuckyBoxAwardCO;
import com.red.circle.other.app.dto.clientobject.game.GameLuckyBoxAwardConfigCO;
import com.red.circle.other.app.dto.clientobject.game.GameLuckyBoxBountyConfigCO;
import com.red.circle.other.app.dto.clientobject.game.GameLuckyBoxCountCO;
import com.red.circle.other.app.dto.clientobject.game.GameLuckyBoxFortuneValueCO;
import com.red.circle.other.app.dto.clientobject.game.GameLuckyBoxStandardConfigCO;
import com.red.circle.other.app.dto.clientobject.game.GameLuckyBoxUserAwardCO;
import com.red.circle.other.app.dto.clientobject.game.GameLuckyBoxUserAwardRecordCO;
import com.red.circle.other.app.dto.cmd.game.GameLuckyBoxAwardCmd;
import com.red.circle.other.app.service.game.GameNewLuckyBoxService;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 新 luckyBox 前端控制器.
 * </p>
 *
 * @author zongpubin
 * @eo.api-type http
 * @eo.groupName 游戏服务.新LuckyBox
 * @eo.path /game/lucky-box
 * @since 2023-8-25
 */
@Slf4j
@Validated
@RestController
@RequestMapping(value = "/game/lucky-box", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class GameNewLuckyBoxRestController extends BaseController {

  private final GameNewLuckyBoxService gameNewLuckyBoxService;

  /**
   * 获取抽奖规格、抽奖频数、抽奖礼物信息
   *
   * @eo.name 获取抽奖规格、抽奖频数、抽奖礼物信息
   * @eo.url /gift/list
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/gift/list")
  public List<GameLuckyBoxStandardConfigCO> getLuckyBoxStandardConfig(AppExtCommand cmd) {
    return gameNewLuckyBoxService.getLuckyBoxStandardConfig(cmd);
  }

  /**
   * 获取赏金任务相关信息
   *
   * @eo.name 获取赏金任务相关信息
   * @eo.url /bounty/list
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/bounty/list")
  public List<GameLuckyBoxBountyConfigCO> getLuckyBoxBountyConfig(AppExtCommand cmd) {
    return gameNewLuckyBoxService.getLuckyBoxBountyConfig(cmd);
  }

  /**
   * 领取赏金任务
   *
   * @eo.name 领取赏金任务
   * @eo.url /bounty/draw
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/bounty/draw")
  public void claimTask(@Validated AppIdLongCmd cmd) {
    gameNewLuckyBoxService.claimTask(cmd);
  }


  /**
   * 获取幸运值相关信息
   *
   * @eo.name 获取幸运值相关信息
   * @eo.url /fortune/value
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/fortune/value")
  public GameLuckyBoxFortuneValueCO getLuckyBoxFortuneValue(AppExtCommand cmd) {
    return gameNewLuckyBoxService.getLuckyBoxFortuneValue(cmd);
  }

  /**
   * 获取抽奖记录
   *
   * @eo.name 获取抽奖记录
   * @eo.url /count/list
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/count/list")
  public List<GameLuckyBoxCountCO> getLuckyBoxCount(LastIdCmd cmd) {
    return gameNewLuckyBoxService.getLuckyBoxCount(cmd);
  }

  /**
   * 获取抽奖奖励配置
   *
   * @eo.name 获取抽奖奖励配置
   * @eo.url /award/list
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/award/list")
  public List<GameLuckyBoxAwardConfigCO> getLuckyBoxAward(AppExtCommand cmd) {
    return gameNewLuckyBoxService.getLuckyBoxAward(cmd);
  }

  /**
   * 开宝箱
   *
   * @eo.name 开宝箱
   * @eo.url /open/box
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/open/box")
  public void openBox(@Validated AppIdLongCmd cmd) {
    gameNewLuckyBoxService.openBox(cmd);
  }


  /**
   * 获取用户抽奖次数
   *
   * @eo.name 获取用户抽奖次数
   * @eo.url /user/award
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/user/award")
  public GameLuckyBoxUserAwardCO getLuckyBoxUserAward(AppExtCommand cmd) {
    return gameNewLuckyBoxService.getLuckyBoxUserAward(cmd);
  }

  /**
   * 用户抽奖
   *
   * @eo.name 用户抽奖
   * @eo.url /award
   * @eo.method post
   * @eo.request-type json
   */
  @PostMapping("/award")
  public GameLuckyBoxAwardCO luckyBoxAward(@RequestBody @Validated GameLuckyBoxAwardCmd cmd) {
    return gameNewLuckyBoxService.luckyBoxAward(cmd);
  }

  /**
   * 获取抽奖记录
   *
   * @eo.name 获取抽奖记录
   * @eo.url /award/record
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/award/record")
  public List<GameLuckyBoxUserAwardRecordCO> getLuckyBoxAwardRecord(AppExtCommand cmd) {
    return gameNewLuckyBoxService.getLuckyBoxAwardRecord(cmd);
  }

  /**
   * 抽奖券数量
   *
   * @eo.name 抽奖券数量
   * @eo.url /award/num
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/award/num")
  public Integer getLuckyBoxUserAwardNumber(AppExtCommand cmd) {
    return gameNewLuckyBoxService.getLuckyBoxUserAwardNumber(cmd);
  }

}
