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.ActivityAgentAnchorContentCO;
import com.red.circle.other.app.service.activity.ActivityAgentAnchorService;
import com.red.circle.other.inner.enums.task.ReceiveStatusEnum;
import com.red.circle.other.inner.model.dto.activity.props.ActivityRewardProps;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.tuple.ImmutableTriple;
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;

/**
 * 代理主播活动.
 *
 * @author lisizhe on 2023/9/25
 * @eo.api-type http
 * @eo.groupName 活动服务.代理主播活动
 * @eo.path /activity/agent-anchor
 */
@RequestMapping("/activity/agent-anchor")
@RestController
@RequiredArgsConstructor
public class ActivityAgentAnchorController extends BaseController {

  private final ActivityAgentAnchorService activityAgentAnchorService;

  /**
   * 代理名下主播当月总积分.
   *
   * @eo.name 代理名下主播当月总积分
   * @eo.url /agent/month/target-reward
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/agent/month/target-reward")
  public ImmutableTriple<Long, List<ImmutableTriple<ReceiveStatusEnum, ActivityAgentAnchorContentCO,
      List<ActivityRewardProps>>>, Long> getAgentMonthTargetReward(AppExtCommand cmd) {
    return activityAgentAnchorService.getAgentMonthTargetReward(cmd);
  }

  /**
   * 代理名下主播数量活动.
   *
   * @eo.name 代理名下主播数量活动
   * @eo.url /agent/anchor/count-reward
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/agent/anchor/count-reward")
  public ImmutableTriple<Long, List<ImmutableTriple<ReceiveStatusEnum, ActivityAgentAnchorContentCO,
      List<ActivityRewardProps>>>, Long> getAgentAnchorCountReward(AppExtCommand cmd) {
    return activityAgentAnchorService.getAgentAnchorCountReward(cmd);
  }

  /**
   * 主播当日积分.
   *
   * @eo.name 主播当日积分
   * @eo.url /anchor/day/target-reward
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/anchor/day/target-reward")
  public ImmutableTriple<Long, List<ImmutableTriple<ReceiveStatusEnum, ActivityAgentAnchorContentCO,
      List<ActivityRewardProps>>>, Long> getAnchorDayTargetReward(AppExtCommand cmd) {
    return activityAgentAnchorService.getAnchorDayTargetReward(cmd);
  }

  /**
   * 主播当月总积分.
   *
   * @eo.name 主播当月总积分
   * @eo.url /anchor/month/target-reward
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping("/anchor/month/target-reward")
  public ImmutableTriple<Long, List<ImmutableTriple<ReceiveStatusEnum, ActivityAgentAnchorContentCO,
      List<ActivityRewardProps>>>, Long> getAnchorMonthTargetReward(AppExtCommand cmd) {
    return activityAgentAnchorService.getAnchorMonthTargetReward(cmd);
  }

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

}
