package com.njcn.prepare.harmonic.controller.line;


import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
import com.njcn.prepare.harmonic.service.mysql.line.ThsSuperviseService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author lxp
 * @since 2023-03-16
 */
@Api(tags = "预警-告警技术监督")
@RestController
@RequestMapping("/thsSupervise")
public class ThsSuperviseController extends BaseController {
    @Autowired
    private ThsSuperviseService thsSuperviseService;

    @ApiOperation("预警/告警事务手动初始化")
    @ApiImplicitParam(name = "superviseParam", value = "新建技术监督参数", required = true)
    @PostMapping("/initSupervise")
    @ResponseBody
    public HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
        return thsSuperviseService.initSupervise(superviseParam);
    }


    @ApiOperation("预警/告警事务自动生成")
    @ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
    @PostMapping("/creatSupervise")
    @ResponseBody
    public HttpResult<String> creatSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
        String methodDescribe = getMethodDescribe("creatSupervise");
        thsSuperviseService.creatSupervise(superviseParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
    }
}

