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 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
 */
@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;

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

    @PreAuthorize(permissionKey = "gameData:choice:accountList")
    @PostMapping("/account/list")
    public ResultVO<List<AccountListVO>> getAccountList(@RequestBody ChoiceListDTO dto) {
        return ResultVO.ok(accountListService.getAccountList(dto));
    }

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

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

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

    @PreAuthorize(permissionKey = "gameData:choice:gameServerList")
    @PostMapping("/gameServer/list")
    public ResultVO<List<GameServerVO>> getPitcherList(@RequestBody GameServerListDTO dto) {
        return ResultVO.ok(gameServerService.getAllGameServer(dto));
    }

}
