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

import com.zanxiang.erp.security.annotation.PreAuthorize;
import com.zanxiang.game.data.serve.pojo.dto.GameServerDayDTO;
import com.zanxiang.game.data.serve.pojo.dto.GameServerDayTotalDTO;
import com.zanxiang.game.data.serve.pojo.dto.GameServerSumDayDTO;
import com.zanxiang.game.data.serve.pojo.dto.GameServerSumDayTotalDTO;
import com.zanxiang.game.data.serve.pojo.vo.GameServerDayTotalVO;
import com.zanxiang.game.data.serve.pojo.vo.GameServerDayVO;
import com.zanxiang.game.data.serve.pojo.vo.GameServerSumDayTotalVO;
import com.zanxiang.game.data.serve.pojo.vo.GameServerSumDayVO;
import com.zanxiang.game.data.serve.service.IGameServerService;
import com.zanxiang.game.data.serve.utils.Page;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tianhua
 * @time 2023/8/14
 * @Description 游戏区服控制层
 **/
@Api(tags = "游戏区服")
@RestController
@RequestMapping("/gameServer")
@Slf4j
public class AdsGameServerController {

    @Autowired
    private IGameServerService gameServerService;

    @ApiOperation(value = "游戏区服数据")
    @PreAuthorize(permissionKey = "gameServer:adsGameServerDay:day")
    @PostMapping("/day")
    public ResultVO<Page<GameServerDayVO>> getGameServerDataDay(@RequestBody GameServerDayDTO dto) {
        return ResultVO.ok(gameServerService.getGameServerDataDay(dto));
    }

    @ApiOperation(value = "游戏区服数据总计一栏")
    @PreAuthorize(permissionKey = "gameServer:adsGameServerDay:dayTotal")
    @PostMapping("/day/total")
    public ResultVO<GameServerDayTotalVO> getGameServerDataDayTotal(@RequestBody GameServerDayTotalDTO dto) {
        return ResultVO.ok(gameServerService.getGameServerDataDayTotal(dto));
    }

    @ApiOperation(value = "游戏区服每日数据")
    @PreAuthorize(permissionKey = "gameServer:GameServerSumDay:day")
    @PostMapping("/sum/day")
    public ResultVO<Page<GameServerSumDayVO>> getGameServerDataSumDay(@RequestBody GameServerSumDayDTO dto) {
        return ResultVO.ok(gameServerService.getGameServerDataSumDay(dto));
    }

    @ApiOperation(value = "游戏区服每日数据总计一栏")
    @PreAuthorize(permissionKey = "gameServer:GameServerSumDay:dayTotal")
    @PostMapping("/sum/day/total")
    public ResultVO<GameServerSumDayTotalVO> getGameServerDataSumDayTotal(@RequestBody GameServerSumDayTotalDTO dto) {
        return ResultVO.ok(gameServerService.getGameServerDataSumDayTotal(dto));
    }

}
