package com.njcn.event.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.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.param.GridDiagramParam;
import com.njcn.device.pq.pojo.vo.GridDiagramVO;
import com.njcn.event.pojo.vo.EventDetailVO;
import com.njcn.event.service.majornetwork.RmpEventDetailService;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RMpEventDetailM;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
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;


@Validated
@Slf4j
@RestController
@RequestMapping("/gridDiagram")
@Api(tags = "冀北电网一张图信息展示")
@AllArgsConstructor
public class GridDiagramEventController extends BaseController {

    private final RmpEventDetailService rmpEventDetailService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getEventLevelEvaluation")
    @ApiOperation("暂态电能质量水平评价")
    public HttpResult<GridDiagramVO> getEventLevelEvaluation(@RequestBody StatSubstationBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getEventLevelEvaluation");
        GridDiagramVO eventLevelEvaluation = rmpEventDetailService.getEventLevelEvaluation(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventLevelEvaluation, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getEventDetailByList")
    @ApiOperation("暂态详细列表")
    public HttpResult<List<EventDetailVO>> getEventDetailByList(@RequestBody GridDiagramParam  param) {
        String methodDescribe = getMethodDescribe("getEventDetailByList");
        List<EventDetailVO> eventDetailByList = rmpEventDetailService.getEventDetailByList(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventDetailByList, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getEventDetailByLineId")
    @ApiOperation("根据监测点获取暂态短时中断和暂态赞升暂降")
    public HttpResult<RMpEventDetailM> getEventDetailByLineId(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getEventDetailByLineId");
        RMpEventDetailM eventDetailByLine = rmpEventDetailService.getEventDetailByLine(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventDetailByLine, methodDescribe);
    }
}
