/*
 * *********************************************************************************************************************
 *
 *          !!
 *        .F88X
 *        X8888Y
 *      .}888888N;
 *        i888888N;        .:!              .I$WI:
 *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
 *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
 *            +888888N;  .8888888Y                                  "&&8Y.}8,
 *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
 *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
 *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
 *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
 *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
 *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
 *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
 *      .:R888888I
 *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
 *        ~8888'
 *        .!88~                                                                     All rights reserved.
 *
 * *********************************************************************************************************************
 */

package com.persagy.server.datacenter.wanda.obj

import com.alibaba.fastjson.annotation.JSONField
import com.persagy.server.datacenter.models.entities.assistant.PointPosition
import com.persagy.server.datacenter.models.entities.assistant.TaskPic
import com.persagy.server.datacenter.datacenter.models.entities.dictnew.DefClass
import com.persagy.server.datacenter.models.entities.objects.SpaceOutline
import com.persagy.server.datacenter.wanda.AttPic
import com.persagy.server.datacenter.wanda.obj.Equipment
import com.persagy.service.models.SBaseEntity
import com.persagy.service.models.annotations.SCascade
import io.swagger.v3.oas.annotations.media.Schema
import java.io.Serializable
import javax.persistence.Column
import javax.persistence.Id
import javax.persistence.Table

/**
 * 空间父类
 *
 * @author  张维新
 */
@Schema(description = "空间父类实体类")
@Table(name = "zone_space_base")
open class ZoneSpace: Serializable, SBaseEntity() {

    /** 空间ID */
    @Schema(description = "空间ID")
    @Id
    @Column(name = "id")
    var id: String? = null

    /** 空间名称 */
    @Schema(description = "空间名称")
    @Column(name = "name")
    var name: String? = null

    /** 空间本地编码 */
    @Schema(description = "空间本地编码")
    @Column(name = "local_id")
    var localId: String? = null

    /** 空间本地名称 */
    @Schema(description = "空间本地名称")
    @Column(name = "local_name")
    var localName: String? = null

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

    /** 建筑id */
    @Schema(description = "建筑id")
    @Column(name = "building_id")
    var buildingId: String? = null

    /** 楼层id */
    @Schema(description = "楼层id")
    @Column(name = "floor_id")
    var floorId: String? = null

    /** 空间二维码图片 */
    @Schema(description = "空间二维码图片")
    @Column(name = "qr_code_pic")
    var qRCodePic: ArrayList<AttPic>? = null

    /** 平台二维码 */
    @Schema(description = "平台二维码")
    @Column(name = "default_qr_code")
    var defaultQRCode: String? = null

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

    /** 轮廓线 */
    @Schema(description = "轮廓线")
    @Column(name = "outline")
    var outline: ArrayList<ArrayList<ArrayList<PointPosition>>>? = null

    /** 轮廓线2 */
    @Schema(description = "轮廓线2")
    @Column(name = "outline2")
    var outline2: ArrayList<ArrayList<ArrayList<PointPosition>>>? = null

    /** 图片  */
    @Schema(description = "图片 ")
    @Column(name = "pic")
    var pic: ArrayList<TaskPic>? =null

    /** 空间常驻人数  */
    @Schema(description = "空间常驻人数 ")
    @Column(name = "permanent_people_num")
    var permanentPeopleNum: Int? =null

    /** 空间是否受影响  */
    @Schema(description = "空间是否受影响 1受影响 0不受影响 ")
    @Column(name = "state")
    var state: Int? =null

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

    /** 进深 */
    @Schema(description = "进深")
    @Column(name = "depth")
    var depth: Double? = null

    /** 面宽 */
    @Schema(description = "面宽")
    @Column(name = "width")
    var width: Double? = null

    /** 建筑面积 */
    @Schema(description = "建筑面积")
    @Column(name = "build_area")
    var buildArea: Double? = null

    /** 使用面积 */
    @Schema(description = "使用面积")
    @Column(name = "net_area")
    var netArea: Double? =null

    /** 高度 */
    @Schema(description = "高度")
    @Column(name = "height")
    var height: Double? = null

    /** 备注文字 */
    @Schema(description = "备注文字")
    @Column(name = "intro")
    var intro: String? =null

    /** 设计供冷功率*/
    @Schema(description = "设计供冷功率 ")
    @Column(name = "rated_coolingp")
    var ratedCoolingP: Double? =null

    /** 设计供热功率 */
    @Schema(description = "设计供热功率 ")
    @Column(name = "rated_heatingp")
    var ratedHeatingP: Double? =null

    /** 空调形式 */
    @Schema(description = "空调形式 ")
    @Column(name = "ac_type")
    var acType: String? =null

    /** 空间朝向 */
    @Schema(description = "空间朝向")
    @Column(name = "zone_orientation")
    var zoneOrientation: String? = null

    /** 空间功能区类型 */
    @Schema(description = "空间功能区类型")
    @Column(name = "func_type")
    var roomFuncType: String? = null

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

    /** 空间序号  */
    @Schema(description = "空间序号 ")
    @Column(name = "room_serial")
    var roomSerial: Double? =null

    /** 项目空间功能区类型  */
    @Schema(description = "项目空间功能区类型 ")
    @Column(name = "proj_room_func_type")
    var projRoomFuncType: String? =null

    /** 设计照明功率 */
    @Schema(description = "设计照明功率")
    @Column(name = "rated_lightp")
    var ratedLightP: String? = null

    /** 内外区类型 */
    @Schema(description = "内外区类型")
    @Column(name = "zone_type")
    var zoneType: String? = null

    /** 租赁业态类型 */
    @Schema(description = "租赁业态类型")
    @Column(name = "tenant_type")
    var tenantType: String? = null

    /** 所属租户 */
    @Schema(description = "所属租户")
    @Column(name = "tenant")
    var tenant: String? = null

    /** 配电容量 */
    @Schema(description = "配电容量")
    @Column(name = "elec_cap")
    var elecCap: Double? =null

    /** 污染等级 */
    @Schema(description = "污染等级")
    @Column(name = "pollution_degree")
    var pollutionDegree: String? =null

    /** 对象类型 */
    @Schema(description = "对象类型")
    @Column(name = "object_type")
     var classCode: String? = null

    /** 级联-设备 */
    @Schema(description = "级联-设备")
    @SCascade(table="relationship.r_eq2sp", idColumn="sp_id", childIdColumn="eq_id",filter = "type = 'eq2sp_in'")
    var equipment: ArrayList<Equipment>? = null

    /** 级联-系统 */
    @Schema(description = "级联-系统")
    @SCascade(table="relationship.r_sy2sp", idColumn="sp_id", childIdColumn="sy_id",filter = "type = 'sy2sp'")
    var generalSystem: ArrayList<GeneralSystem>? = null

    /** 级联-服务于空间的设备 */
    @Schema(description = "级联-服务于空间的设备")
    @SCascade(table="relationship.r_eq2sp", idColumn="sp_id", childIdColumn="eq_id",filter = "type = 'eq2sp_for'")
    var equipmentFor: ArrayList<Equipment>? = null

    /** 级联-建筑 */
    @Schema(description = "级联-建筑")
    @SCascade(table="zone_space_base", idColumn="id", childIdColumn="building_id")
    var building: Building? = null


    /** 级联-楼层  */
    @Schema(description = "级联-楼层")
    @SCascade(table="zone_space_base", idColumn="id", childIdColumn="floor_id")
    var floor: Floor? = null

    /** 级联-空间类型  */
    @Schema(description = "级联-空间类型")
    @SCascade(table="zone_space_base", idColumn="id", childIdColumn="code",self = false)
    @JSONField(name = "zoneName")
    var zoneName: DefClass? = null

    /** 级联-建筑 */
    @Schema(description = "级联-建筑")
    @SCascade(table="r_sp_in_bd", idColumn="space_id", childIdColumn="building_id")
    var buildingList: ArrayList<Building>? = null

    /** 级联-楼层  */
    @Schema(description = "级联-楼层")
    @SCascade(table="r_sp_in_fl", idColumn="space_id", childIdColumn="floor_id")
    var floorlList: ArrayList<Floor>? = null

    /** 对象类型 */
//    @Schema(description = "对象类型")
//    @Column(name = "class_code")
//    var objectType: String? = null

    /** 级联-部件   table  对应关系表   idColumn 对应 本类的id    childIdColumn 级联对象的关系id ，注意 idColumn childIdColumn 非数据表中字段名，是实体类属性*/
    @Schema(description = "级联-轮廓线")
    @SCascade(table="space_outline", idColumn="id", childIdColumn="id",self = false)
    var spaceOutline: SpaceOutline? = null

}