package com.zksy.web.controller.gasbasic;

import com.zksy.base.service.GasMonitorService;
import com.zksy.common.annotation.Anonymous;
import com.zksy.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 场站可燃气体浓度监测
 */
@Api(tags = "燃气监测-场站可燃气体")
@RestController
@RequestMapping("/api/gas-monitor")
@Anonymous
public class GasMonitorController {

    @Autowired
    private GasMonitorService gasMonitorService;

    @GetMapping("/points")
    @ApiOperation("获取场站监测点列表(含最新气体浓度+温度)")
    public AjaxResult getPoints() {
        return AjaxResult.success(gasMonitorService.getPoints());
    }

    @GetMapping("/point/{pointId}/trend")
    @ApiOperation("获取24小时气体浓度趋势")
    public AjaxResult getTrend(@PathVariable String pointId,
                               @RequestParam(defaultValue = "24") int hours) {
        return AjaxResult.success(gasMonitorService.getTrend(pointId, hours));
    }
}
