package com.persagy.server.datacenter.models.entities.objects

import com.persagy.server.datacenter.models.entities.assistant.PointPosition
import com.persagy.server.datacenter.models.entities.base.BaseInfo
import com.persagy.service.models.annotations.SCascade
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import javax.persistence.Column
import javax.persistence.Id
import javax.persistence.Table

/**
 * 竖井信息实体类
 *
 * @author  张维新
 */
@ApiModel(description = "竖井信息实体类")
@Table(name = "shaft")
class Shaft : BaseInfo() {

    /** 竖井id */
    @ApiModelProperty(value = "竖井id")
    @Id
    @Column(name = "id")
    var id: String? = null

    /** 竖井名称 */
    @ApiModelProperty(value = "竖井名称")
    @Column(name = "name")
    var name: String? = null

    /** 竖井本地编码 */
    @ApiModelProperty(value = "竖井本地编码")
    @Column(name = "local_id")
    var localId: String? = null

    /** 竖井本地名称 */
    @ApiModelProperty(value = "竖井本地名称")
    @Column(name = "local_name")
    var localName: String? = null

    /** BIM模型中编码 */
    @ApiModelProperty(value = "BIM模型中编码")
    @Column(name = "bim_id")
    var bimId: String? = null

    /** 设计图纸中编码 */
    @ApiModelProperty(value = "设计图纸中编码")
    @Column(name = "cad_id")
    var cadId: String? = null

    /** 二维码图片 */
    @ApiModelProperty(value = "二维码图片")
    @Column(name = "qr_code_pic")
    var qRCodePic: String? = null

    /** 二维码内容 */
    @ApiModelProperty(value = "二维码内容")
    @Column(name = "default_qr_code")
    var defaultQRCode: String? = null

    /** 项目id */
    @ApiModelProperty(value = "项目id")
    @Column(name = "project_id")
    var projectId: String? = null

    /** BIM模型中坐标 */
    @ApiModelProperty(value = "BIM模型中坐标")
    @Column(name = "bim_location")
    var bimLocation: String? = null

    /** 竖井顺序码 */
    @ApiModelProperty(value = "竖井顺序码")
    @Column(name = "shaft_sequenceId")
    var shaftSequenceId: Int? = null

    /** 信息点 */
    @ApiModelProperty(value = "信息点")
    @Column(name = "infos")
    var infos: HashMap<String, Any?>? = null

    /** BIM模型中轮廓坐标 */
    @ApiModelProperty(value = "BIM模型中轮廓坐标")
    @Column(name = "outline")
    var outline: ArrayList<PointPosition>? = null

    /** 结构信息 */
    @ApiModelProperty(value = "结构信息")
    @Column(name = "structure_info")
    var structureInfo: HashMap<String, Any?>? = null

    /** 设定参数 */
    @ApiModelProperty(value = "设定参数")
    @Column(name = "setting_param")
    var settingParam: HashMap<String, Any?>? = null

    /** 对象类型 */
    @ApiModelProperty(value = "对象类型")
    @Column(name = "object_type")
    override var objectType: String? = "Shaft"

    /** 级联-竖井内的设备 */
    @ApiModelProperty(value = "级联-竖井内的设备")
    @SCascade(table="r_eq_in_sh", idColumn="shaft_id", childIdColumn="equip_id")
    var equipmentList: ArrayList<Equipment>? = null

    /** 级联-竖井内的系统 */
    @ApiModelProperty(value = "级联-竖井内的系统")
    @SCascade(table="r_sy_in_sh", idColumn="shaft_id", childIdColumn="sys_id")
    var systemList: ArrayList<GeneralSystem>? = null

    /** 贯通关系   self = true  同样的对象查询时 id可以互相调换查询   */
    @ApiModelProperty(value = "级联-贯通关系")
    @SCascade(table="r_sh_through_sh", idColumn="shaft_id", childIdColumn="shaft_other_id", self = true)
    var shaftThroughList: ArrayList<Shaft>? = null

    /** 竖井内的业务空间  self = true  同样的对象查询时 id可以互相调换查询   */
    @ApiModelProperty(value = "级联-竖井内的业务空间")
    @SCascade(table="relationship.r_sh2sp", idColumn="sh_id", childIdColumn="sp_id", self = false,filter = "type = 'sh2sp'")
    var spaceList: ArrayList<ZoneSpace>? = null


} // Class Shaft