package com.xydl.cac.controller;

import com.xydl.cac.entity.ThermalConfig;
import com.xydl.cac.model.Response;
import com.xydl.cac.service.ThermalConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@Api(tags = {"热成像测温相关接口"})
@RequestMapping("thermal")
@Slf4j
public class ThermalConfigController extends BasicController {

    @Resource
    ThermalConfigService configService;

    @GetMapping("getConfig")
    @ApiOperation("查询配置")
    public Response<ThermalConfig> getConfig() {
        ThermalConfig result = configService.getConfig();
        return Response.success(result);
    }

    @PostMapping("saveConfig")
    @ApiOperation("修改配置")
    public Response<String> saveConfig(@Validated @RequestBody ThermalConfig model) throws Exception {
        configService.saveConfig(model);
        return Response.success("OK");
    }

}
