package com.ys.bdtp.adm.mvvm.model.db.entity.task

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.google.gson.JsonElement
import com.ys.bdtp.adm.mvvm.model.vo.Location
import com.ys.bdtp.adm.mvvm.model.vo.Outline

/**
 * 空间表
 *
 * @author bai
 *
 * @param id
 * @param name 空间名称
 * @param projectId 项目id
 * @param buildingId 建筑id
 * @param floorId 楼层id
 * @param objType 对象类型: space
 * @param classCode 空间类型编码
 * @param grouping 是否对象组: 1 单个对象 2 对象组
 * @param groupCode 集团编码
 * @param localId 空间坐标id
 * @param localName 空间名称
 * @param infos 空间附加信息: Gson解析后对应 SpaceInfos
 * @param valid 有效标识: 1 有效 2 失效
 * @param modifier 修改者
 * @param modifiedTime 修改时间
 * @param creator 创建者
 * @param creationTime 创建时间
 *
 */
@Entity(tableName = "space")
data class SpaceEntity(
    @PrimaryKey @ColumnInfo(name = "id") val id: String,
    @ColumnInfo(name = "name") val name: String,
    @ColumnInfo(name = "project_id") val projectId: String?,
    @ColumnInfo(name = "building_id") val buildingId: String?,
    @ColumnInfo(name = "floor_id") val floorId: String?,
    @ColumnInfo(name = "obj_type") val objType: String,
    @ColumnInfo(name = "class_code") val classCode: String,
    @ColumnInfo(name = "grouping") val grouping: Int,
    @ColumnInfo(name = "group_code") val groupCode: String,
    @ColumnInfo(name = "local_id") val localId: String,
    @ColumnInfo(name = "local_name") val localName: String,
    @ColumnInfo(name = "infos") val infos: JsonElement? = null,
    @ColumnInfo(name = "valid") var valid: Int = 1,
    @ColumnInfo(name = "creator") val creator: String,
    @ColumnInfo(name = "creator_time") val creationTime: Long,
    @ColumnInfo(name = "modifier") val modifier: String,
    @ColumnInfo(name = "modifier_time") val modifiedTime: Long

)

/**
 * 空间信息点
 */
data class SpaceInfos(
    val height: Double,
    val location: Location,
    val outline: List<List<List<Outline>>>
)