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.AppIdLongCmd;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.app.dto.clientobject.activity.GameWeeklyTaskCO;
import com.red.circle.other.app.service.activity.GameWeeklyTasksActivityService;
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;

/**
 * 游戏每周任务.
 *
 * @author lisizhe on 2023/9/25
 * @eo.api-type http
 * @eo.groupName 活动服务.游戏每周任务
 * @eo.path /activity/game-weekly-tasks
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/activity/game-weekly-tasks", produces = MediaType.APPLICATION_JSON_VALUE)
public class GameWeeklyTasksActivityRestController extends BaseController {

  private final GameWeeklyTasksActivityService gameWeeklyTasksActivityService;

  /**
   * 任务列表.
   *
   * @eo.name 任务列表
   * @eo.method get
   * @eo.request-type formdata
   */
  @GetMapping
  public List<GameWeeklyTaskCO> list(AppExtCommand cmd) {
    return gameWeeklyTasksActivityService.list(cmd);
  }

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

}
