package com.persagy.server.controllers.rel

import com.persagy.server.datacenter.models.entities.rel.RSpatialConnection
import com.persagy.server.services.rel.RSpatialConnectionService
import com.persagy.service.models.requests.SCreateRequest
import com.persagy.service.models.requests.SQueryRequest
import com.persagy.service.models.responses.SBaseResponse
import com.persagy.service.models.responses.SCreateResponse
import com.persagy.service.models.responses.SQueryResponse
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
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

@Api(tags = ["024、关系-空间关系"])
@RestController
@RequestMapping("/rel/sp-rel")
class RSpatialConnectionConreoller {

    /**
     * 创建邻接关系
     */
    @ApiOperation(value="创建邻接关系", notes="图类型 GraphType：空间邻接关系 SpaceNeighborhood 建筑交通关系 TrafficNetwork  空气流通关系  ConvectionNetwork  光照辐射关系  RadiationNetwork ")
    @PostMapping(value = ["/space-neighborhood-Create"])
    fun spaceNeighborhoodCreate(@RequestBody rSiInSpBase: SCreateRequest<RSpatialConnection>): SCreateResponse<RSpatialConnection> {
        return RSpatialConnectionService.create(rSiInSpBase)
    } // Function spaceNeighborhood

    /**
     * 空间关系
    */
    @ApiOperation(value="查询空间关系", notes=" 楼层id FloorId   图类型 GraphType:空间邻接关系 SpaceNeighborhood 建筑交通关系 TrafficNetwork  空气流通关系  ConvectionNetwork  光照辐射关系  RadiationNetwork ，边类型RelType  ")
    @PostMapping(value = ["/space-neighborhood-query"])
    fun spaceNeighborhoodQuery(@RequestBody request: SQueryRequest): SQueryResponse<RSpatialConnection> {
        return RSpatialConnectionService.pageQuerys(request)
    } // Function spaceNeighborhoodQuery


    /**
     * 根据id删除建筑
     *
     * @param   idList      id数组
     * @return              删除的结果信息
     */
    @ApiOperation(value = "删除某一个关系", notes = "必填: SpaceIdOne、SpaceIdTwo、GraphType、ZoneType")
    @PostMapping(value = ["/delete"])
    fun delete(@RequestBody idList: ArrayList<RSpatialConnection>): SBaseResponse {
        return RSpatialConnectionService.delete(idList)
    } // Function delete()

    /**
     * 清除某个楼层下的数据
     *
     * @param   idList      id数组
     * @return              删除的结果信息
     */
    @ApiOperation(value = "清除某个楼层下的数据", notes = "必填 graphType、floorId、ZoneType")
    @PostMapping(value = ["/delete-floor"])
    fun deleteFloor(@RequestBody idList: RSpatialConnection): SBaseResponse {
        return RSpatialConnectionService.deleteFloor(idList)
    } // Function deleteFloor()


} // Class RSpatialConnectionConreoller