package com.njcn.advance.controller;

import com.njcn.advance.pojo.dto.waveAnalysis.EntityAdvancedData;
import com.njcn.advance.service.EventWaveAnalysisService;
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.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * pqs
 * 波形高级分析
 *
 * @author cdf
 * @date 2023/7/28
 */
@RestController
@RequestMapping("waveAnalysis")
@Api(tags = "波形高级分析")
@RequiredArgsConstructor
@Slf4j
public class EventWaveAnalysisController extends BaseController {

    private final EventWaveAnalysisService eventWaveAnalysisService;

    @PostMapping("analysis")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("波形高级分析")
    @ApiImplicitParam(name = "eventIndex", value = "暂降事件id", required = true)
    public HttpResult<EntityAdvancedData> analysis(@RequestParam("eventIndex") String eventIndex) {
        String methodDescribe = getMethodDescribe("analysis");
        EntityAdvancedData entityAdvancedData = eventWaveAnalysisService.analysis(eventIndex);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, entityAdvancedData, methodDescribe);
    }

    @PostMapping("analysisWlEvent")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("物联事件波形高级分析")
    @ApiImplicitParam(name = "eventIndex", value = "暂降事件id", required = true)
    public HttpResult<EntityAdvancedData> analysisWlEvent(@RequestParam("eventIndex") String eventIndex) {
        String methodDescribe = getMethodDescribe("analysisWlEvent");
        EntityAdvancedData entityAdvancedData = eventWaveAnalysisService.analysisWlEvent(eventIndex);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, entityAdvancedData, methodDescribe);
    }
}
