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.IdLongCmd;
import com.red.circle.common.business.dto.cmd.LastIdCmd;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.app.dto.clientobject.game.GameLuckyGiftDataCO;
import com.red.circle.other.app.dto.clientobject.game.GameLuckyGiftMultipleRuleCO;
import com.red.circle.other.app.dto.clientobject.game.GameLuckyGiftUserCO;
import com.red.circle.other.app.dto.cmd.game.GameLuckyGiftCmd;
import com.red.circle.other.app.service.game.GameLuckyGiftService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 幸运礼物 前端控制器.
 * </p>
 *
 * @author pengshigang
 * @eo.api-type http
 * @eo.groupName 游戏服务.幸运礼物
 * @eo.path /game/lucky-gift
 * @since 2022-5-27
 */
@Slf4j
@Validated
@RestController
@RequestMapping(value = "/game/lucky-gift", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class GameLuckyGiftRestController extends BaseController {

  private final GameLuckyGiftService gameLuckyGiftService;

  /**
   * 删除-累计送礼次数.
   *
   * @eo.name 删除-累计送礼次数.
   * @eo.url /user/gift/incr/del
   * @eo.method post
   * @eo.request-type formdata
   */
  @PostMapping("/user/gift/incr/del")
  public void delUserGiftIncrCount(AppExtCommand cmd) {
    gameLuckyGiftService.delUserGiftIncrCount(cmd);
  }

  /**
   * 获得幸运礼物用户计数数据.
   *
   * @eo.name 获得幸运礼物用户计数数据.
   * @eo.url /user/count
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/user/count")
  public GameLuckyGiftDataCO getGiftCount(GameLuckyGiftCmd cmd) {
    return gameLuckyGiftService.getGiftCount(cmd);
  }

  /**
   * 获得幸运礼物每中数量的最大倍数规则声明.
   *
   * @eo.name 获得幸运礼物每中数量的最大倍数规则声明.
   * @eo.url /multiple/rule
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/multiple/rule")
  public GameLuckyGiftMultipleRuleCO getGiftMultipleRule(IdLongCmd cmd) {
    return gameLuckyGiftService.getGiftMultipleRule(cmd);
  }

  /**
   * 用户自己中奖列表.
   *
   * @eo.name 用户自己中奖列表.
   * @eo.url /list/user
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/list/user")
  public List<GameLuckyGiftUserCO> listUser(LastIdCmd cmd) {
    return gameLuckyGiftService.listUser(cmd);
  }

}
