package com.njcn.harmonic.controller.majornetwork;

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.harmonic.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/04/06
 */
@Slf4j
@Api(tags = "大屏")
@RestController
@RequestMapping("/largeScreen")
@RequiredArgsConstructor
public class LargeScreenController extends BaseController {

    private final LargeScreenService largeScreenService;

    /**
     * 稳态指标超标占比(区域)
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getHomeostasisArea")
    @ApiOperation("稳态指标超标占比(区域)")
    @ApiImplicitParam(name = "largeScreenParam", value = "稳态指标超标占比(区域)", required = true)
    public HttpResult<List<HomeostasisAreaVO>> getHomeostasisArea(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getHomeostasisArea");
        List<HomeostasisAreaVO> result = largeScreenService.getHomeostasisArea(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    /**
     * 稳态指标超标占比(负荷类型)
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getHomeostasisLoad")
    @ApiOperation("稳态指标超标占比(负荷类型)")
    @ApiImplicitParam(name = "largeScreenParam", value = "稳态指标超标占比(负荷类型)", required = true)
    public HttpResult<List<HomeostasisAreaVO>> getHomeostasisLoad(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getHomeostasisLoad");
        List<HomeostasisAreaVO> result = largeScreenService.getHomeostasisLoad(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    /**
     * 功率负荷排名
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getPowerOrder")
    @ApiOperation("功率负荷排名")
    @ApiImplicitParam(name = "largeScreenParam", value = "功率负荷排名", required = true)
    public HttpResult<List<PowerOrderVO>> getPowerOrder(@RequestBody @Validated LargeScreenParam largeScreenParam) {
        String methodDescribe = getMethodDescribe("getPowerOrder");
        List<PowerOrderVO> result = largeScreenService.getPowerOrder(largeScreenParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }
}
