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

import com.alibaba.fastjson.annotation.JSONField
import com.persagy.server.datacenter.models.entities.dict.EquipCategory
import com.persagy.server.datacenter.models.entities.objects.Building
import com.persagy.server.datacenter.models.entities.objects.Floor
import com.persagy.server.datacenter.models.entities.objects.Project
import com.persagy.server.datacenter.models.entities.task.base.ScanTaskBase
import com.persagy.service.models.annotations.SCascade
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import javax.persistence.Column
import javax.persistence.Table

/**
 * 模型任务
 *
 * @author  邓婷婷
 */
@ApiModel(description = "模型任务实体类")
@Table(name = "scantask.model_scan_task")
class ModelScanTask : ScanTaskBase() {

    /** 文件夹id */
    @ApiModelProperty(value = "文件夹id")
    @Column(name = "folder_id")
    @JSONField(name = "FolderId")
    var folderId: String? = null

    /** 文件夹名 */
    @ApiModelProperty(value = "文件夹名")
    @Column(name = "folder_name")
    @JSONField(name = "FolderName")
    var folderName: String? = null

    /** 文件id */
    @ApiModelProperty(value = "文件id")
    @Column(name = "file_id")
    @JSONField(name = "FileId")
    var fileId: String? = null

    /** 文件名 */
    @ApiModelProperty(value = "文件名")
    @Column(name = "file_name")
    @JSONField(name = "FileName")
    var fileName: String? = null

    /** 父类id */
    @ApiModelProperty(value = "父类id")
    @Column(name = "parent_id")
//    @Id
    @JSONField(name = "ParentId")
    var parentId: String? = null

    @ApiModelProperty(value = "部件指向父类设备任务id")
    @Column(name = "task_parent_id")
    @JSONField(name = "TaskParentId")
    var taskParentId: String? = null

    /** 级联-项目   table  对应关系表   idColumn 对应 本类的id    childIdColumn 级联对象的关系id */
    @ApiModelProperty(value = "级联-项目")
    @SCascade(table="scantask.model_scan_task", idColumn="id", childIdColumn="project_id")
    @JSONField(name = "Project")
    var project: Project? = null

    /** 级联-建筑 */
    @ApiModelProperty(value = "级联-建筑")
    @SCascade(table="scantask.model_scan_task", idColumn="id", childIdColumn="building_id")
    @JSONField(name = "Building")
    var building: Building? = null

    /** 级联-楼层 */
    @ApiModelProperty(value = "级联-楼层")
    @SCascade(table="scantask.model_scan_task", idColumn="id", childIdColumn="floor_id")
    @JSONField(name = "Floor")
    var floor: Floor? = null

    /** 级联-方案*/
    @ApiModelProperty(value = "级联-方案")
    @SCascade(table="scantask.model_scan_task", idColumn="id", childIdColumn="scheme_id")
    @JSONField(name = "ScanScheme")
    var scanScheme: ScanScheme? = null

    /** 级联-部件*/
    @ApiModelProperty(value = "级联-部件")
    @SCascade(table="scantask.model_scan_task", idColumn="parent_id", childIdColumn="equip_id")
    @JSONField(name = "Component")
    var component: ArrayList<ModelScanTask>? = null

    /** 级联-设备分类 */
    @ApiModelProperty(value = "级联-设备分类")
    @SCascade(table="scantask.model_scan_task", idColumn="id", childIdColumn="category")
    @JSONField(name = "EquipCategory")
    var equipCategory: EquipCategory? = null

} // Class ModelScanTask