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.model.base.IDParam;
import com.zhongshu.card.client.model.devices.DeviceUseRecordModel;
import com.zhongshu.card.client.openApi.model.device.DeviceUseRecordOpenApiSearch;
import com.zhongshu.card.server.core.service.openAPI.device.DeviceUseRecordOpenApiService;
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/deviceUseRecord")
@Tag(name = "openAPI-设备使用记录")
public class DeviceUseApiController {

    @Autowired
    private DeviceUseRecordOpenApiService deviceUseRecordOpenApiService;

    @Operation(summary = "设备使用记录-分页查询", description = "设备使用记录-分页查询")
    @RequestMapping(value = {"page"}, method = {RequestMethod.POST})
    public ResultContent<Page<DeviceUseRecordModel>> page(
            @RequestBody DeviceUseRecordOpenApiSearch param) {
        return deviceUseRecordOpenApiService.page(param);
    }

    @Operation(summary = "设使用详情--根据设备ID查询", description = "设使用详情-根据设备ID查询")
    @RequestMapping(value = {"detailById"}, method = {RequestMethod.POST})
    public ResultContent<DeviceUseRecordModel> detailById(@RequestBody IDParam param) {
        return deviceUseRecordOpenApiService.detailById(param);
    }

}
