package com.ycwl.basic.controller.pc;

import com.ycwl.basic.model.pc.scenicDeviceStats.req.DeviceStatsReq;
import com.ycwl.basic.model.pc.scenicDeviceStats.resp.ScenicDeviceStatsListResp;
import com.ycwl.basic.utils.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
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;

@RestController
@RequestMapping("/api/deviceStats/v1")
public class DeviceStatsController {
    @Autowired
    private com.ycwl.basic.service.pc.DeviceStatsService service;

    @PostMapping("/{scenicId}")
    public ApiResponse<ScenicDeviceStatsListResp> queryByScenic(@PathVariable("scenicId") Long scenicId, @RequestBody DeviceStatsReq req) {
        return ApiResponse.success(service.queryByScenicId(scenicId, req.getStartTime(), req.getEndTime()));
    }
}
