package com.njcn.advance.controller.carrycapacity;

import com.njcn.advance.pojo.carrycapacity.param.CarryCapacityStrategyParam;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityStrategyDhlVO;
import com.njcn.advance.pojo.carrycapacity.vo.CarryCapacityStrategyVO;
import com.njcn.advance.service.carrycapacity.CarryCapacityStrategyDhlPOService;
import com.njcn.advance.service.carrycapacity.CarryCapacityStrategyPOService;
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 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Description:
 * Date: 2024/3/5  10:35【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
@RestController
@RequestMapping("carrycapacity")
@Api(tags = "承载能力评估策略配置")
@RequiredArgsConstructor
public class CarryCapacityStrategyController extends BaseController {


    private final CarryCapacityStrategyPOService carryCapacityStrategyPOService;
    private final CarryCapacityStrategyDhlPOService carryCapacityStrategyDhlPOService;


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/add")
    @ApiOperation("用户新增承载能力评估策略（光伏）")
    @ApiImplicitParam(name = "carryCapacityStrategyParam", value = "新增参数", required = true)
    public HttpResult<Boolean> add(@RequestBody @Validated CarryCapacityStrategyParam carryCapacityStrategyParam) {
        String methodDescribe = getMethodDescribe("add");
        Boolean flag = carryCapacityStrategyPOService.add(carryCapacityStrategyParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
    }
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/addList")
    @ApiOperation("用户新增承载能力评估策略组（光伏）")
    @ApiImplicitParam(name = "carryCapacityStrategyParamList", value = "新增参数", required = true)
    public HttpResult<Boolean> addList(@RequestBody @Validated List<CarryCapacityStrategyParam> carryCapacityStrategyParamList) {
        String methodDescribe = getMethodDescribe("addList");
        Boolean flag = carryCapacityStrategyPOService.addList(carryCapacityStrategyParamList);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
    }
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/queyDetail")
    @ApiOperation("承载能力评估策略初始化查询（光伏）")
    public HttpResult<List<CarryCapacityStrategyVO>> queyDetail() {
        String methodDescribe = getMethodDescribe("queyDetail");
        List<CarryCapacityStrategyVO> carryCapacityStrategyVOList = carryCapacityStrategyPOService.queyDetail();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, carryCapacityStrategyVOList, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/restore")
    @ApiOperation("承载能力评估策略一键还原")
    public HttpResult<Boolean> restore() {
        String methodDescribe = getMethodDescribe("restore");
        Boolean flag = carryCapacityStrategyPOService.restore();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/adddhl")
    @ApiOperation("用户新增承载能力评估策略（电弧炉）")
    @ApiImplicitParam(name = "capacityStrategyDhlVO", value = "新增参数", required = true)
    public HttpResult<Boolean> adddhl(@RequestBody @Validated CarryCapacityStrategyDhlVO capacityStrategyDhlVO) {
        String methodDescribe = getMethodDescribe("adddhl");
        Boolean flag = carryCapacityStrategyDhlPOService.adddhl(capacityStrategyDhlVO);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/queyDetailDhl")
    @ApiOperation("承载能力评估策略初始化查询（电弧炉）")
    public HttpResult<List<CarryCapacityStrategyDhlVO>> queyDetailDhl() {
        String methodDescribe = getMethodDescribe("queyDetailDhl");
        List<CarryCapacityStrategyDhlVO> car = carryCapacityStrategyDhlPOService.queyDetailDhl();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, car, methodDescribe);
    }

}
