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

import com.mybatisflex.core.row.Row;
import com.zanxiang.erp.security.annotation.PreAuthorize;
import com.zanxiang.game.gs.data.serve.pojo.dto.*;
import com.zanxiang.game.gs.data.serve.pojo.vo.*;
import com.zanxiang.game.gs.data.serve.service.IAdsGsServerDayParentService;
import com.zanxiang.game.gs.data.serve.service.IAdsRoleAmountDataParentService;
import com.zanxiang.game.gs.data.serve.service.IAdsRoleAmountRateParentService;
import com.zanxiang.game.gs.data.serve.service.IAdsServerRankingParentService;
import com.zanxiang.module.util.pojo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
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;

import javax.annotation.Resource;

@Api(tags = {"GS充值付费比"})
@RestController
@RequestMapping("/game/parent")
public class GameParentController {
    @Resource
    private IAdsRoleAmountDataParentService adsRoleAmountDataParentService;
    @Resource
    private IAdsRoleAmountRateParentService adsRoleAmountRateParentService;
    @Resource
    private IAdsGsServerDayParentService gsServerDayParentService;
    @Resource
    private IAdsServerRankingParentService serverRankingParentService;

    @ApiOperation(value = "大R每日充值比")
    @PreAuthorize(permissionKey = "gameGs:bigR:list")
    @PostMapping("/bigR/listOfPage")
    public ResultVO<PageVO<BigRVO, Row>> bigRListOfPage(@Validated @RequestBody BigRDTO dto) {
        return ResultVO.ok(adsRoleAmountDataParentService.bigRListOfPage(dto));
    }

    @ApiOperation(value = "GS角色付费留存")
    @PreAuthorize(permissionKey = "gameGs:rolePay:list")
    @PostMapping("/role/pay/retained/listOfPage")
    public ResultVO<PageVO<RolePayVO, Row>> rolePay(@Validated @RequestBody RolePayDTO dto) {
        return ResultVO.ok(adsRoleAmountRateParentService.rolePayOfPage(dto));
    }

    @ApiOperation(value = "GS角色付费留存总计")
    @PreAuthorize(permissionKey = "gameGs:rolePay:total")
    @PostMapping("/role/pay/retained/total")
    public ResultVO<RolePayVO> rolePayTotal(@Validated @RequestBody RolePayDTO dto) {
        return ResultVO.ok(adsRoleAmountRateParentService.rolePayTotal(dto));
    }

    @ApiOperation(value = "GS区服付费留存")
    @PreAuthorize(permissionKey = "gameGs:serverPay:list")
    @PostMapping("/server/pay/retained/listOfPage")
    public ResultVO<PageVO<ServerPayVO, Row>> serverPay(@Validated @RequestBody ServerPayDTO dto) {
        return ResultVO.ok(gsServerDayParentService.serverPay(dto));
    }

    @ApiOperation(value = "GS区服付费留存总计")
    @PreAuthorize(permissionKey = "gameGs:serverPay:total")
    @PostMapping("/server/pay/retained/total")
    public ResultVO<ServerPayVO> serverPayTotal(@Validated @RequestBody ServerPayDTO dto) {
        return ResultVO.ok(gsServerDayParentService.serverPayTotal(dto));
    }

    @ApiOperation(value = "角色流失监控")
    @PreAuthorize(permissionKey = "gameGs:roleRemoveGame:monitor")
    @PostMapping("/role/remove/game/monitor")
    public ResultVO<PageVO<RoleRemoveGameMonitorVO, Row>> roleRemoveGameMonitor(@Validated @RequestBody RoleRemoveGameMonitorDTO dto) {
        return ResultVO.ok(adsRoleAmountDataParentService.roleRemoveGameMonitor(dto));
    }

    @ApiOperation(value = "游戏角色管理")
    @PreAuthorize(permissionKey = "gameGs:role:manage")
    @PostMapping("/role/manage")
    public ResultVO<PageVO<RoleManageVO, Row>> roleManage(@Validated @RequestBody RoleManageDTO dto) {
        return ResultVO.ok(adsRoleAmountDataParentService.roleManage(dto));
    }

    @ApiOperation(value = "游戏区服管理")
    @PreAuthorize(permissionKey = "gameGs:serve:manage")
    @PostMapping("/serve/manage")
    public ResultVO<PageVO<ServeManageVO, Row>> serveManage(@Validated @RequestBody ServeManageDTO dto) {
        return ResultVO.ok(serverRankingParentService.serveManage(dto));
    }

}
