package com.njcn.event.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.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.UniversalFrontEndParam;
import com.njcn.event.pojo.vo.EventDistributionStatisticsTableVO;
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
import com.njcn.event.pojo.vo.RStatSubstationVO;
import com.njcn.event.pojo.vo.SimpleVO;
import com.njcn.event.service.distribution.PwEventCategoryDetailsService;
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 yzh
 * @date 2022/10/27
 */
@RestController
@RequestMapping("/pwEventCategoryDetails")
@Api(tags = "配网-暂态事件分布统计")
@RequiredArgsConstructor
public class PwEventCategoryDetailsController extends BaseController {

    private final PwEventCategoryDetailsService pwEventCategoryDetailsService;

    /**
     * 获取配网区域暂态指标统计
     *
     * @param param 前端传入参数
     * @return 配网区域暂态指标统计
     */
    @PostMapping("/getPwEventCategoryDetails")
    @OperateInfo(info = LogEnum.SYSTEM_COMMON)
    @ApiOperation("获取配网暂态事件分布统计")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<EventDistributionStatisticsTableVO>> getPwEventCategoryDetails(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getPwEventCategoryDetails");
        List<EventDistributionStatisticsTableVO> list = pwEventCategoryDetailsService.getPwEventCategoryDetails(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    /**
     * 获取配网持续时间概率分布函数
     *
     * @param param 前端传入参数
     * @return 配网持续时间概率分布函数
     */
    @PostMapping("/getPwDurationLineChart")
    @OperateInfo(info = LogEnum.SYSTEM_COMMON)
    @ApiOperation("获取配网持续时间概率分布函数")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<SimpleVO>> getPwDurationLineChart(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getPwDurationLineChart");
        List<SimpleVO> list = pwEventCategoryDetailsService.getPwDurationLineChart(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    /**
     * 获取配网暂降幅值概率分布函数
     *
     * @param param 前端传入参数
     * @return 配网持续时间概率分布函数
     */
    @PostMapping("/getPwFeatureAmplitudeLineChart")
    @OperateInfo(info = LogEnum.SYSTEM_COMMON)
    @ApiOperation("获取配网暂降幅值概率分布函数")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<SimpleVO>> getPwFeatureAmplitudeLineChart(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getPwFeatureAmplitudeLineChart");
        List<SimpleVO> list = pwEventCategoryDetailsService.getPwFeatureAmplitudeLineChart(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    /**
     * 获取配网暂态指标分布统计曲线图
     *
     * @param param 前端传入参数
     * @return 配网持续时间概率分布函数
     */
    @PostMapping("/getPwEventFeatureAmplitudeCurve")
    @OperateInfo(info = LogEnum.SYSTEM_COMMON)
    @ApiOperation("获取配网暂态指标分布统计曲线图")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<EventFeatureAmplitudeCurveVO> getPwEventFeatureAmplitudeCurve(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getPwEventFeatureAmplitudeCurve");
        EventFeatureAmplitudeCurveVO vo = pwEventCategoryDetailsService.getPwEventFeatureAmplitudeCurve(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
    }

    /**
     * 获取变电站暂态指标分类统计表
     *
     * @param param 前端传入参数
     * @return 变电站暂态指标分类统计表
     */
    @PostMapping("/getPwRStatSubstation")
    @OperateInfo(info = LogEnum.SYSTEM_COMMON)
    @ApiOperation("获取变电站暂态指标分类统计表")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<RStatSubstationVO>> getPwRStatSubstation(@RequestBody UniversalFrontEndParam param) {
        String methodDescribe = getMethodDescribe("getPwRStatSubstation");
        List<RStatSubstationVO> list = pwEventCategoryDetailsService.getRStatSubstation(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }
}
