package net.northking.cctp.testbug.api;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.northking.cctp.common.http.ResultWrapper;
import net.northking.cctp.testbug.api.service.MtBusinessRuleService;
import net.northking.cctp.testbug.dto.BusinessRuleDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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;

/**
 * 缺陷管理业务规则 => Restful 类型 HTTP/HTTPS 接口
 *
 * @author maven-cctp-plugin
 * @since 1.0
 */
@Api(tags = "缺陷管理业务规则")
@RequestMapping("/v1/MtBusinessRule")
@RestController
public class MtBusinessRuleResultCtrl {
    /**
     * 日志
     */
    private final static Logger logger = LoggerFactory.getLogger(MtBusinessRuleResultCtrl.class);

    @Autowired
    private MtBusinessRuleService apiService;

    /**
     * 获取业务规则配置
     * @param inputDto       主键
     * @return 接口数据传输对象
     */
    @ApiOperation(value = "获取业务规则配置")
    @PostMapping(
            value = "/getBusinessRuleConfig",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
            consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResultWrapper<BusinessRuleDto> getBusinessRuleConfig(
            @RequestBody @Validated BusinessRuleDto inputDto)
    {
        ResultWrapper<BusinessRuleDto> wrapper = new ResultWrapper<>();
        BusinessRuleDto dto = apiService.getBusinessRuleConfig(inputDto);
        return wrapper.success(dto);
    }

}
