package com.njcn.csharmonic.controller;


import cn.hutool.json.JSONArray;
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.LimitCalendarQueryParam;
import com.njcn.csharmonic.pojo.param.LimitExtentDayQueryParam;
import com.njcn.csharmonic.pojo.param.LimitExtentQueryParam;
import com.njcn.csharmonic.pojo.param.LimitProbabilityQueryParam;
import com.njcn.csharmonic.pojo.vo.LimitCalendarVO;
import com.njcn.csharmonic.pojo.vo.LimitExtentVO;
import com.njcn.csharmonic.pojo.vo.LimitProbabilityVO;
import com.njcn.csharmonic.pojo.vo.LimitTimeProbabilityVO;
import com.njcn.csharmonic.service.IRStatLimitRateDetailDService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Validated
@RestController
@RequiredArgsConstructor
@Api(tags = "合格率统计日表详细(越限详情)")
public class RStatLimitRateDetailDController extends BaseController {

    private final IRStatLimitRateDetailDService limitRateDetailDService;

    @PostMapping("/limitRateDetailD/limitExtentData")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取指标越限程度数据")
    public HttpResult<List<LimitExtentVO>> limitExtentData(@RequestBody LimitExtentQueryParam queryParam) {
        String methodDescribe = getMethodDescribe("limitExtentData");
        List<LimitExtentVO> result = limitRateDetailDService.limitExtentData(queryParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    @PostMapping("/limitRateDetailD/limitExtentDayData")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取指标日趋势图数据")
    public HttpResult<JSONArray> limitExtentDayData(@RequestBody LimitExtentDayQueryParam queryParam) {
        String methodDescribe = getMethodDescribe("limitExtentDayData");
        JSONArray result = limitRateDetailDService.limitExtentDayData(queryParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    @PostMapping("/limitRateDetailD/limitCalendarData")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取指标越限明细日历数据")
    public HttpResult<List<LimitCalendarVO>> limitCalendarData(@RequestBody LimitCalendarQueryParam queryParam) {
        String methodDescribe = getMethodDescribe("limitCalendarData");
        List<LimitCalendarVO> result = limitRateDetailDService.limitCalendarData(queryParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }


    @PostMapping("/limitRateDetailD/limitProbabilityData")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取指标越限程度概率分布数据")
    public HttpResult<List<LimitProbabilityVO>> limitProbabilityData(@RequestBody LimitProbabilityQueryParam queryParam) {
        String methodDescribe = getMethodDescribe("limitProbabilityData");
        List<LimitProbabilityVO> result = limitRateDetailDService.limitProbabilityData(queryParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    @PostMapping("/limitRateDetailD/limitTimeProbabilityData")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取指标越限时间概率分布数据")
    public HttpResult<List<LimitTimeProbabilityVO>> limitTimeProbabilityData(@RequestBody LimitProbabilityQueryParam queryParam) {
        String methodDescribe = getMethodDescribe("limitTimeProbabilityData");
        List<LimitTimeProbabilityVO> result = limitRateDetailDService.limitTimeProbabilityData(queryParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }


}
