package com.njcn.device.pms.controller.distribution;

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.pms.pojo.param.OverviewParam;
import com.njcn.device.pms.pojo.vo.OverviewVO;
import com.njcn.device.pms.service.majornetwork.OverviewService;
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 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;

/**
 * <分布式光伏概览>
 *
 * @author wr
 * @createTime: 2022-12-29
 */
@RestController
@RequestMapping("/pwOverview")
@Api(tags = "分布式光伏概览")
@RequiredArgsConstructor
public class PwOverviewController extends BaseController {

    private final OverviewService overviewService;


    @PostMapping("/getAlarmProportion")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("告警监测点数占比")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<OverviewVO.AlarmVO>> getAlarmProportion(@RequestBody OverviewParam.OverviewDateParam param) {
        String methodDescribe = getMethodDescribe("getAlarmProportion");
        List<OverviewVO.AlarmVO> monitorYoY = overviewService.getAlarmProportion(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorYoY, methodDescribe);
    }

    @PostMapping("/getAlarmRating")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("告警评级")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<OverviewVO.AreaAlarmCountVO>> getAlarmRating(@RequestBody OverviewParam.OverviewDateParam param) {
        String methodDescribe = getMethodDescribe("getAlarmRating");
        List<OverviewVO.AreaAlarmCountVO> groupVOS = overviewService.getAlarmRating(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, groupVOS, methodDescribe);
    }

}
