package com.persagy.server.controllers

import com.persagy.server.datacenter.models.entities.objects.Equipment
import com.persagy.server.datacenter.models.entities.objects.GeneralSystem
import com.persagy.server.datacenter.models.entities.objects.Shaft
import com.persagy.server.models.objects.FloorCompon
import com.persagy.server.models.requests.ShaftSpaceVertical
import com.persagy.server.service.EquipmentZoneService
import com.persagy.server.service.objects.EquipmentService
import com.persagy.server.service.objects.GeneralSystemService
import com.persagy.server.service.objects.ShaftService
import com.persagy.service.models.requests.SQueryRequest
import com.persagy.service.models.responses.SQueryResponse
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
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 张维新
 */
@Api(tags = ["竖井相关接口"])
@RestController
@RequestMapping("/shaft")
class ShaftController {
    @Autowired
    lateinit var equipmentZoneService: EquipmentZoneService
    /**
     * 查询没有和当前竖井绑定的系统
     *
     * @param   shaftId     竖井id
     */
    @ApiOperation(value="查询没有和当前竖井绑定的系统", notes="")
    @PostMapping(value = ["/unshaft-in-sys"])
    fun unShaftSys(shaftId: String,@RequestBody request: SQueryRequest): SQueryResponse<GeneralSystem> {
        return GeneralSystemService.unShaftSys(shaftId, request)
    } // Function unSpaceSys()

    /**
     * 查询没有和当前竖井绑定的设备
     */
    @ApiOperation(value="查询没有和当前竖井绑定的设备", notes="")
    @PostMapping(value = ["/unshaft-in-eq"])
    fun  unShaftEq( shaftId: String,@RequestBody request: SQueryRequest): SQueryResponse<Equipment> {
        return EquipmentService.pageQueryShaftEquip(shaftId,request)
    } // Function unSpaceEq()

    @ApiOperation(value="查询没有和当前竖井贯通的其它竖井", notes="")
    @PostMapping(value = ["/unshaft-through-shaft"])
    fun  unShaftThroughShaft(shaftId: String,@RequestBody request: SQueryRequest): SQueryResponse<Shaft> {
        return ShaftService.unShaftThroughShaft(shaftId,request)
    } // Function unSpaceEq()

    @ApiOperation(value="查询竖井关联的空间垂直交通关系", notes="")
    @PostMapping(value = ["/shaft-vertical-space"])
    fun shaftSpaceVertical(@RequestBody request: ShaftSpaceVertical): SQueryResponse<FloorCompon>{
//        equipmentZoneService.similars()
        return ShaftService.shaftSpace(request)
    } // Function shaftSpaceVertical()

    /**
     * 计算 和当前竖井有关联的空间的垂直交通关系
     */
    @ApiOperation(value="计算 和当前竖井有关联的空间的垂直交通关系", notes="")
    @PostMapping(value = ["/vertical-space"])
    fun shaftVerticalSp(@RequestBody request: ShaftSpaceVertical): SQueryResponse<FloorCompon>{
        return ShaftService.spVerticalSp(request)
    } // Fun


}  // Class SpaceController