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

import com.zanxiang.erp.security.annotation.PreAuthorize;
import com.zanxiang.game.data.serve.pojo.dto.*;
import com.zanxiang.game.data.serve.pojo.vo.*;
import com.zanxiang.game.data.serve.service.IGameServerService;
import com.zanxiang.game.data.serve.utils.Page;
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.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 游戏区服控制层
 **/
@RestController
@RequestMapping("/gameServer")
@Slf4j
public class AdsGameServerController {

    @Autowired
    private IGameServerService gameServerService;

    @PreAuthorize(permissionKey = "gameServer:adsGameServerDay:day")
    @PostMapping("/day")
    public ResultVO<Page<GameServerDayVO>> getGameServerDataDay(@RequestBody GameServerDayDTO dto) {
        return ResultVO.ok(gameServerService.getGameServerDataDay(dto));
    }

    @PreAuthorize(permissionKey = "gameServer:adsGameServerDay:dayTotal")
    @PostMapping("/day/total")
    public ResultVO<GameServerDayTotalVO> getGameServerDataDayTotal(@RequestBody GameServerDayTotalDTO dto) {
        return ResultVO.ok(gameServerService.getGameServerDataDayTotal(dto));
    }

    @PreAuthorize(permissionKey = "gameServer:GameServerSumDay:day")
    @PostMapping("/sum/day")
    public ResultVO<Page<GameServerSumDayVO>> getGameServerDataSumDay(@RequestBody GameServerSumDayDTO dto) {
        return ResultVO.ok(gameServerService.getGameServerDataSumDay(dto));
    }

    @PreAuthorize(permissionKey = "gameServer:GameServerSumDay:dayTotal")
    @PostMapping("/sum/day/total")
    public ResultVO<GameServerSumDayTotalVO> getGameServerDataSumDayTotal(@RequestBody GameServerSumDayTotalDTO dto) {
        return ResultVO.ok(gameServerService.getGameServerDataSumDayTotal(dto));
    }

    @PreAuthorize(permissionKey = "gameServer:GSAdsGameServerDay:day")
    @PostMapping("/gs/day")
    public ResultVO<Page<GSGameServerDayVO>> getGSGameServerDataDay(@RequestBody GSGameServerDayDTO dto) {
        return ResultVO.ok(gameServerService.getGSGameServerDataDay(dto));
    }

    @PreAuthorize(permissionKey = "gameServer:GSAdsGameServerDay:total")
    @PostMapping("/gs/total")
    public ResultVO<GSGameServerDayVO> getGSGameServerDataDayTotal(@RequestBody GSGameServerDayDTO dto) {
        return ResultVO.ok(gameServerService.getGSGameServerDataDayTotal(dto));
    }
}
