package com.persagy.revit.controllers.modelFile

import com.persagy.revit.models.monitor.ModelMonitor
import com.persagy.revit.services.BaseDataService
import com.persagy.service.models.requests.SQueryRequest
import com.persagy.service.models.requests.SUpdateRequest
import com.persagy.service.models.responses.SBaseResponse
import com.persagy.service.models.responses.SQueryResponse
import io.swagger.v3.oas.annotations.tags.Tag
import io.swagger.v3.oas.annotations.Operation
import org.slf4j.LoggerFactory
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

/**
 *
 *
 * @author jxing
 */
@Tag(name = "楼层模型接口")
@RestController
@RequestMapping("/model-monitor")
class ModelMonitorController {
    companion object {
        // 日志
        private val logger = LoggerFactory.getLogger(FloorModelController::class.java)
    } // Companion object

    val dataService = BaseDataService


    /**
     * 查询监控记录
     *
     * @param   request     查询请求
     * @return  查询结果应答信息
     */
    @Operation(summary = "查询监控记录", description =  "")
    @PostMapping(value = ["/query"])
    fun query(@RequestBody request: SQueryRequest): SQueryResponse<ModelMonitor> {
        return dataService.modelMonitorService.pageQuery(request)
    } // Function query()

    /**
     * 更新监控记录
     *
     * @param   request     更新请求
     * @return  更新结果应答信息
     */
    @Operation(summary = "更新监控记录", description =  "")
    @PostMapping(value = ["/update"])
    fun update(@RequestBody request: SUpdateRequest<ModelMonitor>): SBaseResponse {
        return dataService.modelMonitorService.updateList(request)
    } // Function update()
}