package com.persagy.server.models

import com.alibaba.fastjson.annotation.JSONField
import com.persagy.server.datacenter.models.entities.base.BaseInfo
import com.persagy.server.models.objects.ZoneSpace
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

@ApiModel(description = "租户信息实体类")
@Table(name = "tenant")
class TenantCascade : BaseInfo() {

    /** 租户id */
    @ApiModelProperty(value = "租户id")
    @Id
    @Column(name = "id")
    @JSONField(name = "TenantID")
    var id: String? = null

    /** 租户名称 */
    @ApiModelProperty(value = "租户名称")
    @Column(name = "name")
    @JSONField(name = "TenantName")
    var name: String? = null

    /** 租户本地编码 */
    @ApiModelProperty(value = "租户本地编码")
    @Column(name = "local_id")
    @JSONField(name = "TenantLocalID")
    var localId: String? = null

    /** 租户本地名称 */
    @ApiModelProperty(value = "租户本地名称")
    @Column(name = "local_name")
    @JSONField(name = "TenantLocalName")
    var localName: String? = null

    /** 租户本地编码2 */
    @ApiModelProperty(value = "租户本地编码2")
    @Column(name = "local_id2")
    @JSONField(name = "TenantLocalID2")
    var localId2: String? = null

    /** 租户本地名称2 */
    @ApiModelProperty(value = "租户本地名称2")
    @Column(name = "local_name2")
    @JSONField(name = "TenantLocalName2")
    var localName2: String? = null

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

    /** 租赁信息 */
    @ApiModelProperty(value = "租赁信息")
    @Column(name = "lease_info")
    @JSONField(name = "LeaseInfo")
    var leaseInfo: HashMap<String,Any?>? = null

    /** 能耗信息 */
    @ApiModelProperty(value = "能耗信息")
    @Column(name = "consumption_info")
    @JSONField(name = "ConsumptionInfo")
    var consumptionInfo: HashMap<String,Any?>? = null

    /** 动态信息 */
    @ApiModelProperty(value = "动态信息")
    @Column(name = "dynamic_infor")
    @JSONField(name = "DynamicInfor")
    var dynamicInfor: HashMap<String,Any?>? = null

    /** 自定义信息点 */
    @ApiModelProperty(value = "自定义信息点")
    @Column(name = "custom_param")
    @JSONField(name = "CustomParam")
    var customParam: HashMap<String,Any?>? = null

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


    /** 租户租赁的租户业务空间  self = true  同样的对象查询时 id可以互相调换查询   */
    @ApiModelProperty(value = "级联-租户租赁的租户业务空间")
    @SCascade(table="relationship.r_tn2sp", idColumn="tn_id", childIdColumn="sp_id", self = true)
    @JSONField(name = "ZoneTenantList")
    var zoneTenantList: ArrayList<ZoneSpace>? = null

    /** 租户租赁的默认业务空间  self = true  同样的对象查询时 id可以互相调换查询   */
//    @ApiModelProperty(value = "级联-租户租赁的默认业务空间")
//    @SCascade(table="r_tn_in_sp_zone_general", idColumn="tenant_id", childIdColumn="space_id", self = true)
//    @JSONField(name = "ZoneGeneraltList")
//    var zoneGeneraltList: ArrayList<ZoneGeneral>? = null

    /** 租户租赁的业务空间  self = true  同样的对象查询时 id可以互相调换查询   */
//    @ApiModelProperty(value = "级联-租户租赁的业务空间")
//    @SCascade(table="r_tn_in_sp_base", idColumn="tenant_id", childIdColumn="space_id", self = false)
//    @JSONField(name = "ZoneList")
//    var zoneList: ArrayList<ZoneSpaceBaseTable>? = null


} // Class Tenant