package com.zanxiang.game.data.serve.controller;

import com.zanxiang.erp.security.annotation.PreAuthorize;
import com.zanxiang.game.data.serve.pojo.dto.ChoiceListDTO;
import com.zanxiang.game.data.serve.pojo.dto.GameServerListDTO;
import com.zanxiang.game.data.serve.pojo.vo.*;
import com.zanxiang.game.data.serve.service.*;
import com.zanxiang.module.util.pojo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author tianhua
 * @version 1.0
 * @description:  下拉选择列表
 * @date 2023/11/3 15:33
 */
@Api(tags = {"下拉选择列表"})
@RestController
@RequestMapping("/choice")
@Slf4j
public class ChoiceListController {

    @Autowired
    private IGameListService gameListService;

    @Autowired
    private IAccountListService accountListService;

    @Autowired
    private IAgentListService agentListService;

    @Autowired
    private IPitcherListService pitcherListService;

    @Autowired
    private IVipLevelService vipLevelService;

    @Autowired
    private IGameServerService gameServerService;

    @ApiOperation(value = "所有游戏列表")
    @PreAuthorize(permissionKey = "gameData:choice:gameList")
    @PostMapping("/game/list")
    public ResultVO<GameListVO> getGameDataDay(@RequestBody ChoiceListDTO dto) {
        return ResultVO.ok(gameListService.getGameList(dto));
    }

    @ApiOperation(value = "所有广告账号列表")
    @PreAuthorize(permissionKey = "gameData:choice:accountList")
    @PostMapping("/account/list")
    public ResultVO<List<AccountListVO>> getAccountList(@RequestBody ChoiceListDTO dto) {
        return ResultVO.ok(accountListService.getAccountList(dto));
    }

    @ApiOperation(value = "所有渠道列表")
    @PreAuthorize(permissionKey = "gameData:choice:agentList")
    @PostMapping("/agent/list")
    public ResultVO<List<AgentListVO>> getAgentList(@RequestBody ChoiceListDTO dto) {
        return ResultVO.ok(agentListService.getAgentList(dto));
    }

    @ApiOperation(value = "所有投手列表")
    @PreAuthorize(permissionKey = "gameData:choice:pitcherList")
    @PostMapping("/pitcher/list")
    public ResultVO<List<PitcherListVO>> getPitcherList(@RequestBody ChoiceListDTO dto) {
        return ResultVO.ok(pitcherListService.getPitcherList(dto));
    }

    @ApiOperation(value = "最大VIP等级")
    @PreAuthorize(permissionKey = "gameData:choice:maxVipLevel")
    @GetMapping("/vip/level")
    public ResultVO<Integer> getMaxVipLevel() {
        return ResultVO.ok(vipLevelService.getMaxVipLevel());
    }

    @ApiOperation(value = "所有区服列表（原始区服）")
    @PreAuthorize(permissionKey = "gameData:choice:gameServerList")
    @PostMapping("/gameServer/list")
    public ResultVO<List<GameServerVO>> getPitcherList(@RequestBody GameServerListDTO dto) {
        return ResultVO.ok(gameServerService.getAllGameServer(dto));
    }

}
