package com.njcn.event.controller.majornetwork;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.param.LargeScreenParam;
import com.njcn.device.pq.pojo.vo.*;

import com.njcn.event.service.majornetwork.LargeScreenService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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 java.util.List;

/**
 * @version 1.0.0
 * @author: zbj
 * @date: 2023/03/31
 */
@Slf4j
@Api(tags = "大屏")
@RestController
@RequestMapping("/largeScreen")
@RequiredArgsConstructor
public class LargeScreenController extends BaseController {

    private final LargeScreenService largeScreenService;

    /**
     * 暂降事件区域
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getAreaDownStatistics")
    @ApiOperation("暂降事件区域")
    @ApiImplicitParam(name = "largeScreenParam", value = "暂降事件区域", required = true)
    public HttpResult<AreaDownVO> getAreaDownStatistics(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getAreaDownStatistics");
        AreaDownVO result = largeScreenService.getAreaDownStatistics(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    /**
     * 暂降事件负荷类型
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getLoadType")
    @ApiOperation("暂降事件负荷类型")
    @ApiImplicitParam(name = "largeScreenParam", value = "暂降事件负荷类型", required = true)
    public HttpResult<List<LoadTypeVO>> getLoadType(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getLoadType");
        List<LoadTypeVO> result = largeScreenService.getLoadType(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    /**
     * 暂降事件时间统计
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getTimeCount")
    @ApiOperation("暂降事件时间统计")
    @ApiImplicitParam(name = "largeScreenParam", value = "暂降事件时间统计", required = true)
    public HttpResult<List<DownTimeVO>> getTimeCount(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getTimeCount");
        List<DownTimeVO> result = largeScreenService.getTimeCount(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    /**
     * 大屏获取暂降事件最新50条数据
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/eventLists")
    @ApiOperation("大屏获取暂降事件最新50条数据")
    @ApiImplicitParam(name = "largeScreenParam", value = "大屏获取暂降事件最新50条数据", required = true)
    public HttpResult<List<EventVO>> eventLists(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("eventLists");
        List<EventVO> result = largeScreenService.eventLists(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    /**
     * 大屏中间所有数据
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getAllData")
    @ApiOperation("大屏中间所有数据")
    @ApiImplicitParam(name = "largeScreenParam", value = "大屏中间所有数据", required = true)
    public HttpResult<List<AllDataVO>> getAllData(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getAllData");
        List<AllDataVO> result = largeScreenService.getAllData(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    /**
     * 大屏中间暂态
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getMiddleDown")
    @ApiOperation("大屏中间暂态")
    @ApiImplicitParam(name = "largeScreenParam", value = "大屏中间暂态", required = true)
    public HttpResult<EventListVO> getMiddleDown(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getMiddleDown");
        EventListVO result = largeScreenService.getMiddleDown(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    /**
     * 大屏中间终端异常信息
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getMiddleTerminal")
    @ApiOperation("大屏中间终端异常信息")
    @ApiImplicitParam(name = "largeScreenParam", value = "大屏中间终端异常信息", required = true)
    public HttpResult<MiddleTerminalListVO> getMiddleTerminal(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getMiddleTerminal");
        MiddleTerminalListVO result = largeScreenService.getMiddleTerminal(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    /**
     * 大屏中间稳态越线信息
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getMiddleLimitRate")
    @ApiOperation("大屏中间稳态越线信息")
    @ApiImplicitParam(name = "largeScreenParam", value = "大屏中间稳态越线信息", required = true)
    public HttpResult<Page<MiddleLimitRateVO>> getMiddleLimitRate(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getMiddleLimitRate");
        Page<MiddleLimitRateVO> result = largeScreenService.getMiddleLimitRate(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }
}
