package com.sz.admin.monitor.controller;

import com.sz.admin.monitor.service.DeviceService;
import com.sz.core.common.entity.ApiResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: DeviceController
 * Package: com.sz.admin.monitor.controller
 * Description:
 */
@Tag(name = "设备表")
@RestController
@RequestMapping("device")
@RequiredArgsConstructor
@Profile({"dev", "local", "preview"})
public class DeviceController {
    private final DeviceService deviceService;
    // 通道刷新
    @Operation(summary = "通道刷新")
    @GetMapping("/refresh")
    public ApiResult<Boolean> refresh(@RequestParam("id") Long id, @RequestParam("deviceType") Integer deviceType) {
        return ApiResult.success(deviceService.refresh(id,deviceType));
    }
    // 设备登录
    @Operation(summary = "/设备登录")
    @GetMapping("/login")
    public ApiResult<?> deviceLogin(@RequestParam("id") Long id)
    {
        return ApiResult.success(deviceService.deviceLogin(id));
    }
}
