package com.njcn.advance.controller;

import com.njcn.advance.pojo.dto.EventAnalysisDTO;
import com.njcn.advance.event.service.IEventAdvanceService;
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.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;

/**
 * @author hongawen
 * @version 1.0
 * @data 2025/7/30 10:38
 */
@Slf4j
@RestController
@RequestMapping("/eventAdvance")
@Api(tags = "暂降高级分析")
@RequiredArgsConstructor
public class EventCauseController extends BaseController {

    private final IEventAdvanceService eventAdvanceService;

    @PostMapping(value = "/analysisCauseAndType")
    @ApiOperation("分析暂降事件的原因和类型")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    public HttpResult<EventAnalysisDTO> analysisCauseAndType(@RequestBody EventAnalysisDTO eventAnalysis) {
        String methodDescribe = getMethodDescribe("analysisCauseAndType");
        eventAnalysis = eventAdvanceService.analysisCauseAndType(eventAnalysis);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventAnalysis, methodDescribe);
    }

}
