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

import com.zanxiang.erp.security.annotation.PreAuthorize;
import com.zanxiang.game.data.serve.pojo.dto.AdsOrderDetailDTO;
import com.zanxiang.game.data.serve.pojo.dto.AdsOrderDetailListDTO;
import com.zanxiang.game.data.serve.pojo.dto.AdsOrderDetailTotalDTO;
import com.zanxiang.game.data.serve.pojo.vo.AdsOrderDetailTotalVO;
import com.zanxiang.game.data.serve.pojo.vo.AdsOrderDetailVO;
import com.zanxiang.game.data.serve.pojo.vo.OrderCPDetailVO;
import com.zanxiang.game.data.serve.service.IAdsOrderDetailService;
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.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;

@Slf4j
@RestController
@RequestMapping("/order")
public class AdsOrderDetailController {

    @Autowired
    private IAdsOrderDetailService gameOrderService;

    @PreAuthorize(permissionKey = "gameData:order:list")
    @PostMapping("/list")
    public ResultVO<Page<AdsOrderDetailVO>> orderList(@Validated @RequestBody AdsOrderDetailListDTO dto) {
        return ResultVO.ok(gameOrderService.listOfPage(dto));
    }

    @PreAuthorize(permissionKey = "gameData:order:listTotal")
    @PostMapping("/list/total")
    public ResultVO<AdsOrderDetailTotalVO> orderTotal(@Validated @RequestBody AdsOrderDetailTotalDTO dto) {
        return ResultVO.ok(gameOrderService.orderTotal(dto));
    }

    @PreAuthorize(permissionKey = "gameData:order:detail")
    @PostMapping("/detail")
    public ResultVO<Page<OrderCPDetailVO>> getOrderDetailList(@RequestBody AdsOrderDetailDTO dto) {
        return ResultVO.ok(gameOrderService.getOrderDetailList(dto));
    }


}
