package com.njcn.csharmonic.controller;

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.csharmonic.pojo.param.EventStatisticParam;
import com.njcn.csharmonic.pojo.vo.event.EventCoordsVO;
import com.njcn.csharmonic.pojo.vo.event.EventStatisticVO;
import com.njcn.csharmonic.pojo.vo.event.F47Curve;
import com.njcn.csharmonic.service.event.EventOverviewService;
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;

import java.util.List;
import java.util.Map;

/**
 * @Author: cdf
 * @CreateTime: 2025-11-20
 * @Description: 暂降概览
 */
@Slf4j
@RestController
@RequestMapping("/csevent")
@Api(tags = "暂降概览")
@RequiredArgsConstructor
public class EventOverviewController extends BaseController {

    private final EventOverviewService eventOverviewService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("暂降类型分类统计Echart")
    @PostMapping("netEventEcharts")
    public HttpResult<EventStatisticVO> netEventEcharts(@RequestBody EventStatisticParam baseParam){
        String methodDescribe = getMethodDescribe("netEventEcharts");
        EventStatisticVO eventStatisticVO =  eventOverviewService.netEventEcharts(baseParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventStatisticVO, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("暂降类型分类统计表格")
    @PostMapping("netEventTable")
    public HttpResult<List<EventStatisticVO>> netEventTable(@RequestBody EventStatisticParam baseParam){
        String methodDescribe = getMethodDescribe("netEventTable");
        List<EventStatisticVO> list =  eventOverviewService.netEventTable(baseParam);

        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("F47曲线")
    @PostMapping("f47Curve")
    public HttpResult<List<F47Curve>> getF47Curve(@RequestBody EventStatisticParam baseParam){
        String methodDescribe = getMethodDescribe("getF47Curve");
        List<F47Curve> list =  eventOverviewService.getF47Curve(baseParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("日历暂降事件详情")
    @PostMapping("getEventDate")
    public HttpResult<List<EventStatisticVO>> getEventDate(@RequestBody EventStatisticParam baseParam){
        String methodDescribe = getMethodDescribe("getEventDate");
        List<EventStatisticVO> list =  eventOverviewService.getEventDate(baseParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getEventCoords")
    @ApiOperation("获取电压暂态表及密度坐标图")
    public HttpResult<EventCoordsVO> getEventCoords(@RequestBody EventStatisticParam baseParam){
        String methodDescribe = getMethodDescribe("getEventCoords");
        EventCoordsVO  vo = eventOverviewService.getEventCoords(baseParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,vo,methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getEventDirectionData")
    @ApiOperation("获取暂降方向统计数据")
    public HttpResult<List<Map<String,Object>>> getEventDirectionData(@RequestBody EventStatisticParam baseParam){
        String methodDescribe = getMethodDescribe("getEventDirectionData");
        List<Map<String,Object>> list = eventOverviewService.getEventDirectionData(baseParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
    }


}
