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.EventDistributionStatisticsTableVO;
import com.njcn.event.pojo.vo.EventFeatureAmplitudeCurveVO;
import com.njcn.event.pojo.vo.SimpleVO;
import com.njcn.event.service.majornetwork.EventDistributionStatisticsService;
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/20
 */

@RestController
@RequestMapping("/eventDistributionStatistics")
@Api(tags = "主网-暂态指标分布统计")
@RequiredArgsConstructor
public class EventDistributionStatisticsController extends BaseController {

    private final EventDistributionStatisticsService eventDistributionStatisticsService;

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

    /**
     * 获取持续时间折线图
     *
     * @param param 前端传入参数
     * @return 持续时间折线图
     */
    @PostMapping("/getEventDurationLineChart")
    @OperateInfo(info = LogEnum.SYSTEM_COMMON)
    @ApiOperation("获取持续时间折线图")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<SimpleVO>> getEventDurationLineChart(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getEventDurationLineChart");
        List<SimpleVO> list = eventDistributionStatisticsService.getEventDurationLineChart(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    /**
     * 获取特征幅值折线图
     *
     * @param param 前端传入参数
     * @return 特征幅值折线图
     */
    @PostMapping("/getEventFeatureAmplitudeLineChart")
    @OperateInfo(info = LogEnum.SYSTEM_COMMON)
    @ApiOperation("获取特征幅值折线图")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<SimpleVO>> getEventFeatureAmplitudeLineChart(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getEventFeatureAmplitudeLineChart");
        List<SimpleVO> list = eventDistributionStatisticsService.getEventFeatureAmplitudeLineChart(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

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