/*
 * ********************************************************************************************************************
 *
 *                      :*$@@%$*:                         ;:                ;;    ;;
 *                    :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
 *                   :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
 *                   =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
 *                   =@*                                  %!              @ $= % %@=   =%@!      %=
 *              *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
 *            %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
 *          ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
 *          $@*   ;@@@%=!:                *@*
 *          =@$    ;;;!=%@@@@=!           =@!
 *           %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2019.  北京上格云技术有限公司
 *            ;%@@$=$@@%*       *@@@$=%@@%;
 *               ::;::             ::;::                                              All rights reserved.
 *
 * ********************************************************************************************************************
 */

package com.persagy.revit.models.modelFile

import com.alibaba.fastjson.annotation.JSONField
import com.persagy.revit.models.entities.Unit
import com.persagy.service.models.SBaseEntity
import io.swagger.v3.oas.annotations.media.Schema
import org.springframework.stereotype.Component
import java.util.*
import javax.persistence.Column
import javax.persistence.Id
import javax.persistence.Table

/**
 *
 *
 * @author jxing
 */
@Schema(description = "模型文件")
@Table(name = "revit.model_file")
@Component
class ModelFile : SBaseEntity() {

    /** 表id, uuid */
   @Schema(description = "模型id, uuid")
    @Column(name = "id")
    @Id
    var id: String? = null

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

    /** 模型文件名 */
   @Schema(description = "模型文件名")
    @Column(name = "original_name")
    var modelName: String? = null

    /** 版本号 */
   @Schema(description = "版本号")
    @Column(name = "version")
    var version: Int? = null

    /** 版本号 */
   @Schema(description = "模型的revit版本号")
    @Column(name = "revit_version")
    var revitVersion: String? = null

    /** 上传人用户id */
   @Schema(description = "上传人用户id")
    @Column(name = "user_id")
    var userId: String? = null

    /** 上传人用户名 */
   @Schema(description = "上传人用户名")
    @Column(name = "user_name")
    var userName: String? = null

    /** 模型文件状态 */
   @Schema(description = "模型文件状态, 0=上传中, 1=上传完毕, 2=模型初步检查完成, 3=同步数据完成")
    @Column(name = "status")
    var status: Int? = null

    /** 上传完成, 初步校验完成时间 */
   @Schema(description = "上传完成, 初步校验完成时间")
    @Column(name = "accept_time")
    var acceptTime: Date? = null

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

    /** 处理日志 */
   @Schema(description = "处理日志")
    @Column(name = "log")
    var log: Map<String, Any?>? = null

    /** 模型文件替换原因, 1 画错, 2 工程改造 */
   @Schema(description = "模型文件替换原因, 1 画错, 2 工程改造")
    @Column(name = "replace_reason")
    var replaceReason: Int? = null

    /** 工程改造竣工时间(当replaceReason是工程改造时使用) */
   @Schema(description = "工程改造竣工时间(当replaceReason是工程改造时使用)")
    @Column(name = "project_finish_time")
    var projectFinishTime: Date? = null

    /** 模型url */
   @Schema(description = "模型url")
    @Column(name = "url")
    var url: String? = null

    @JSONField(serialize = false)
    var upLoadUrl: String? = null

    @JSONField(serialize = false)
    var fileKey: String? = null

    /** 模型md5值 */
   @Schema(description = "模型md5值")
    @Column(name = "md5")
    var md5: String? = null

    /** 模型所属楼层(FloorModel外键) */
   @Schema(description = "模型所属楼层(FloorModel外键)")
    @Column(name = "model_floor_id")
    var floorModelId: String? = null

    /** 标记模型文件是否已被删除, true是已删除 */
   @Schema(description = "标记模型文件是否已被删除, true是已删除")
    @Column(name = "removed")
    var removed: Boolean? = null

    // new

    /** 文件长度 */
   @Schema(description = "文件长度")
    @Column(name = "size")
    var size: Long? = null

    /** 单位 */
   @Schema(description = "单位")
    @Column(name = "units")
    var units: Unit? = null

    /** 当前楼层代表的平面图名称 */
   @Schema(description = "当前楼层代表的平面图名称")
    @Column(name = "plan_name")
    var planName: String? = null

    /** mbi名 */
   @Schema(description = "mbi名")
    @Column(name = "mbi_name")
    var mbiName: String? = null

    /** 调度器信息 */
   @Schema(description = "调度器信息")
    @Column(name = "scheduler_info")
    var taskInfo: SchedulerInfo? = null

    /** 数据中心同步数据重试次数 */
   @Schema(description = "数据中心同步数据重试次数")
    @Column(name = "sync_retry_times")
    var syncRetryTimes: Int? = null

    /** 数据中心同步数据上次重试时间 */
   @Schema(description = "数据中心同步数据上次重试时间")
    @Column(name = "sync_retry_date")
    var syncRetryDate: Date? = null

    /** 数据中心同步数据错误信息 */
   @Schema(description = "数据中心同步数据错误信息")
    @Column(name = "sync_error_msg")
    var syncErrorMsg: String? = null

    /** 数据中心楼层id */
    @JSONField(serialize = false)
    var floorIdDataCenter: String? = null

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

    /** 模型文件检查结果中非阻塞性检查是否有错误 */
   @Schema(description = "模型文件检查结果中非阻塞性检查是否有错误")
    @Column(name = "data_check_result")
    var dataCheckResult: Boolean? = null

    /** 是否强制删除 */
   @Schema(description = "是否强制删除")
    var isForce: Boolean? = null

    /** 调度器信息 */
   @Schema(description = "调度器信息")
    @Column(name = "status_info")
    var statusInfo: StatusInfo? = null
}