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


import com.red.circle.common.business.dto.cmd.AppExtCommand;
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.activity.ActivityCumulativeRechargeCO;
import com.red.circle.other.app.dto.clientobject.activity.ActivityCumulativeRewardPropsCO;
import com.red.circle.other.app.service.activity.CumulativeRechargeService;
import com.red.circle.other.inner.model.dto.activity.props.ActivityRewardProps;
import com.red.circle.other.inner.model.cmd.user.CumulativeRechargeCmd;
import com.red.circle.other.inner.model.dto.user.UserCustomGiftRecordDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
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;

/**
 * 累计充值.
 *
 * @author lisizhe on 2023/9/25
 * @eo.api-type http
 * @eo.groupName 活动服务.累计充值
 * @eo.path /activity/cumulative-recharge
 */
@RequestMapping("/activity/cumulative-recharge")
@RestController
@RequiredArgsConstructor
public class CumulativeRechargeRestController extends BaseController {

  private final CumulativeRechargeService cumulativeRechargeService;

  /**
   * 领取奖励.
   *
   * @eo.name 领取奖励
   * @eo.method post
   * @eo.request-type json
   */
  @PostMapping
  public void receiveAward(@RequestBody @Validated AppIdLongCmd cmd) {
    cumulativeRechargeService.receiveAward(cmd);
  }

  /**
   * 用户月度充值奖励列表.
   *
   * @eo.url /recharge-reward
   * @eo.name 用户月度充值奖励列表
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/recharge-reward")
  public ActivityCumulativeRechargeCO rechargeRewardList(AppExtCommand cmd) {
    return cumulativeRechargeService.listRechargeReward(cmd);
  }

  /**
   * 每日累计用户抽奖.
   *
   * @eo.url /lottery
   * @eo.name 每日累计用户抽奖
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/lottery")
  public ActivityRewardProps lottery(AppIdLongCmd cmd) {
    return cumulativeRechargeService.lottery(cmd);
  }

  /**
   * 奖励池.
   *
   * @eo.url /list/award/pool
   * @eo.name 奖励池
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/list/award/pool")
  public List<ActivityCumulativeRewardPropsCO> listRewardPool(AppExtCommand cmd) {
    return cumulativeRechargeService.listRewardPool(cmd);
  }

  /**
   * 获取用户专属礼物资料.
   */
  @GetMapping("/custom/gift/{id}")
  public UserCustomGiftRecordDTO userCustomGift(@PathVariable("id") Long id) {
    return cumulativeRechargeService.userCustomGift(id);
  }

  /**
   * 上传专属礼物资料.
   */
  @PostMapping("/upload")
  public void uploadResource(@RequestBody @Validated CumulativeRechargeCmd cmd) {
    cumulativeRechargeService.uploadResource(cmd);
  }

}
