package com.zhongshu.card.server.core.controller.openAPI.device;

import com.github.microservice.net.ResultContent;
import com.github.microservice.staticVariable.OpenApiMark;
import com.zhongshu.card.client.openApi.model.device.DeviceInfoOpenApiModel;
import com.zhongshu.card.client.openApi.params.DeviceIdParam;
import com.zhongshu.card.client.openApi.params.DeviceInfoOpenApiSearch;
import com.zhongshu.card.server.core.service.openAPI.device.DevicePermissOpenApiService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author TRX
 * @date 2024/6/5
 */
@RestController
@RequestMapping("/" + OpenApiMark.fullCardOpenAPI + "/v1/device")
@Tag(name = "openAPI-设备管理")
public class DeviceOpenApiController {

    @Autowired
    private DevicePermissOpenApiService devicePermissOpenApiService;

    @Operation(summary = "设备列表-分页查询", description = "设备列表-分页查询")
    @RequestMapping(value = {"page"}, method = {RequestMethod.POST})
    public ResultContent<Page<DeviceInfoOpenApiModel>> page(@RequestBody DeviceInfoOpenApiSearch param) {
        return devicePermissOpenApiService.page(param);
    }

    @Operation(summary = "设备详情--根据设备ID查询", description = "设备详情-根据设备ID查询")
    @RequestMapping(value = {"getDetailByDeviceId"}, method = {RequestMethod.POST})
    public ResultContent<DeviceInfoOpenApiModel> getDetailByDeviceId(@RequestBody DeviceIdParam param) {
        return devicePermissOpenApiService.getDetailByDeviceId(param);
    }

}
