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

import com.red.circle.console.app.service.app.game.GameFruitTaskConfigService;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.game.fruit.inner.model.cmd.GameFruitBountyConfigQryCmd;
import com.red.circle.game.fruit.inner.model.cmd.GameFruitTaskConfigQryCmd;
import com.red.circle.game.fruit.inner.model.dto.GameFruitAwardPictureDTO;
import com.red.circle.game.fruit.inner.model.dto.GameFruitBountyConfigDTO;
import com.red.circle.game.fruit.inner.model.dto.GameFruitTaskConfigDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
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 zongpubin on 2023-12-13
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/game/fruit")
public class GameFruitTaskConfigRestController extends BaseController {

  private final GameFruitTaskConfigService gameFruitTaskConfigService;

  /**
   * 获赏金任务规格配置信息.
   */
  @GetMapping("/bounty-config")
  public PageResult<GameFruitBountyConfigDTO> getGameFruitBountyConfig(
      GameFruitBountyConfigQryCmd query) {
    return gameFruitTaskConfigService.getGameFruitBountyConfig(query);
  }

  /**
   * 新增/修改赏金任务配置.
   */
  @PostMapping("/bounty-config")
  public void addGameFruitBountyConfig(
      @RequestBody @Validated GameFruitBountyConfigDTO param) {
    param.setOperationUser(param.getReqUserId());
    gameFruitTaskConfigService.addGameFruitBountyConfig(param);
  }

  /**
   * 删除赏金任务配置.
   */
  @DeleteMapping("/bounty-config/{id}")
  public void deleteGameFruitBountyConfig(@PathVariable("id") Long id) {
    gameFruitTaskConfigService.deleteGameFruitBountyConfig(id);
  }

  /**
   * 任务配置信息.
   */
  @GetMapping("/task-config")
  public PageResult<GameFruitTaskConfigDTO> getGameFruitTaskConfig(
      GameFruitTaskConfigQryCmd query) {
    return gameFruitTaskConfigService.getGameFruitTaskConfig(query);
  }

  /**
   * 新增/修改任务配置.
   */
  @PostMapping("/task-config")
  public void addGameFruitTaskConfig(
      @RequestBody @Validated GameFruitTaskConfigDTO param) {
    gameFruitTaskConfigService.addGameFruitTaskConfig(param);
  }

  /**
   * 删除任务配置.
   */
  @DeleteMapping("/task-config/{id}")
  public void deleteGameFruitTaskConfig(@PathVariable("id") Long id) {
    gameFruitTaskConfigService.deleteGameFruitTaskConfig(id);
  }

  /**
   * 获取游戏奖项图片信息.
   */
  @GetMapping("/images/{sysOrigin}")
  public List<GameFruitAwardPictureDTO> getGameFruitImages(@PathVariable("sysOrigin") String sysOrigin) {
    return gameFruitTaskConfigService.getGameFruitImages(sysOrigin);
  }


}
