package cn.sagacloud.server.algorithm.controllers.modelEntity

import cn.sagacloud.server.algorithm.models.request.BaseGraphRequest
import cn.sagacloud.server.algorithm.services.endpoint.BaseGraphService
import com.sybotan.service.models.responses.SBaseResponse
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
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
 */
@Api(tags = ["获取底图接口"])
@RestController
@RequestMapping("/base-graph")
class BaseGraphController {
    companion object {
        // 日志
        private val logger = LoggerFactory.getLogger(BeaconController::class.java)
    } // Companion object

    /**
     * 查询底图
     *
     * @param   request     查询请求
     * @return  查询结果应答信息
     */
    @ApiOperation(value="查询底图", notes="")
    @PostMapping(value = ["/query"])
    fun query(@RequestBody request: BaseGraphRequest): SBaseResponse {
        return BaseGraphService.composeBaseGraph(request)
    } // Function query()


    //    if (response.result == SResponseType.success) {
//        val bgRequest = BaseGraphRequest()
//        bgRequest.modelId = request.currentModelId
//        val bg = baseGraph.query(bgRequest)
//        if (bg.result == SResponseType.success) {
//            // 上传文件
//            return response
//        }else{
//            return SBaseResponse(SResponseType.failure,"获取底图失败")
//        }
//    }
}