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.event.pojo.vo.RSubstationIcon2VO;
import com.njcn.event.pojo.vo.RSubstationIconVO;
import com.njcn.event.pojo.vo.RVoltageIconVO;
import com.njcn.event.service.majornetwork.RStatSubstationMService;
import com.njcn.event.service.majornetwork.RStatSubstationVoltageMService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author rui.wu
 * @since 2022-10-18
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标分类概览-变电站分类总览")
@RequestMapping("/event/rStatSubstation")
public class RStatSubstationController extends BaseController {

    private final RStatSubstationMService rStatSubstationMService;
    private final RStatSubstationVoltageMService rStatSubstationVoltageMService;

    /**
     * 变电站暂态指标超标分布（按发生频次）
     */
    @GetMapping("/getStatSubstationIconDistributed")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("变电站暂态分布（按发生频次）")
    public HttpResult<RSubstationIconVO> getStatSubstationIconDistributed(StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getStatSubstationIconDistributed");
        RSubstationIconVO statSubstationIcon = rStatSubstationMService.getStatSubstationIcon(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
    }

    /**
     * 变电站暂态分布（按电压等级）
     */
    @GetMapping("/getStatSubstationIconVoltage")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("变电站暂态分布（按电压等级）")
    public HttpResult<List<RVoltageIconVO>> getStatSubstationIconVoltage(StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getStatSubstationIconVoltage");
        List<RVoltageIconVO> statSubstationIcon = rStatSubstationVoltageMService.getStatSubstationIcon(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
    }


    /**
     * 变电站暂态指标发生频次
     */
    @GetMapping("/getStatSubstationIconIndex")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("变电站暂态指标发生频次")
    public HttpResult<List<RSubstationIcon2VO>> getStatSubstationIconIndex(StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getStatSubstationIconIndex");
        List<RSubstationIcon2VO> statSubstationIcon = rStatSubstationMService.getStatSubstationIcon2(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
    }
}

