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

import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import java.io.Serializable
import javax.persistence.Column
import javax.persistence.Id
import javax.persistence.Table

/**
 * 平台对象信息点
 *
 * @author  wx
 * @date  2020/9/19 17:41
 */
@ApiModel(description = "平台对象信息点")
@Table(name = "dict.def_funcid")
class DefFuncId: Serializable {

    /** 全局id */
    @ApiModelProperty(value = "全局id")
    @Id
    @Column(name = "id")
    var id: String? = null

    /** 类型编码 */
    @ApiModelProperty(value = "类型编码")
    @Id
    @Column(name = "class_code")
    var classCode: String? = null

    /** 动静分类:静态STATIC,脉冲PULSE,阶段GRADATION,时序SEQUENTIAL */
    @ApiModelProperty(value = "动静分类:静态STATIC,脉冲PULSE,阶段GRADATION,时序SEQUENTIAL")
    @Column(name = "category")
    var category: String? = null

    /** 信息点编码 */
    @ApiModelProperty(value = "信息点编码")
    @Id
    @Column(name = "code")
    var code: String? = null

    /** 信息点名称 */
    @ApiModelProperty(value = "信息点名称")
    @Column(name = "name")
    var name: String? = null

    /** 分类:commo平台级, group集团级, project项目级 */
    @ApiModelProperty(value = "分类:commo平台级, group集团级, project项目级")
    @Id
    @Column(name = "type")
    var type: String? = null

    /** 集团id, 默认为"0" */
    @ApiModelProperty(value = "集团id, 默认为'0'")
    @Column(name = "group_code")
    var groupCode: String? = null

    /** 项目id, 默认为"0" */
    @ApiModelProperty(value = "项目id, 默认为'0'")
    @Column(name = "project_id")
    var projectId: String? = null

    /** 数据类型 */
    @ApiModelProperty(value = "数据类型")
    @Column(name = "data_type")
    var dataType: String? = null

    /** 数据格式 */
    @ApiModelProperty(value = "数据格式")
    @Column(name = "formater")
    var formater: String? = null

    /** 数据格式 */
    @ApiModelProperty(value = "数据格式")
    @Column(name = "data_source")
    var dataSource: ArrayList<Any?>? = null

    /** 输入方式 */
    @ApiModelProperty(value = "输入方式")
    @Column(name = "input_mode")
    var inputMode: String? = null

    /** 一级标签 */
    @ApiModelProperty(value = "一级标签")
    @Column(name = "first_tag")
    var firstTag: String? = null

    /** 一级名称 */
    @ApiModelProperty(value = "一级名称")
    @Column(name = "first_name")
    var firstName: String? = null

    /** 二级标签 */
    @ApiModelProperty(value = "二级标签")
    @Column(name = "second_tag")
    var secondTag: String? = null

    /** 二级名称 */
    @ApiModelProperty(value = "二级名称")
    @Column(name = "second_name")
    var secondName: String? = null

    /** 序列 */
    @ApiModelProperty(value = "序列")
    @Column(name = "idx")
    var idx: Int? = null

    /** 优先级,重要程度 */
    @ApiModelProperty(value = "优先级,重要程度")
    @Column(name = "priority")
    var priority: String? = null

    /** 单位 */
    @ApiModelProperty(value = "单位")
    @Column(name = "unit")
    var unit: String? = null

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

    /** 输入类型 */
    @ApiModelProperty(value = "输入类型")
    @Column(name = "orig_data_type")
    var origDataType: String? = null

    /** 旧信息点编码 */
    @ApiModelProperty(value = "旧信息点编码")
    @Column(name = "orig_code")
    var origCode: String? = null

    /** 是否分类标签 */
    @ApiModelProperty(value = "是否分类标签")
    @Column(name = "can_sub")
    var canSub: Boolean? = null

    /** 是否复数 */
    @ApiModelProperty(value = "是否复数")
    @Column(name = "is_multiple")
    var isMultiple: Boolean? = null

    /** 是否区间 */
    @ApiModelProperty(value = "是否区间")
    @Column(name = "is_region")
    var isRegion: Boolean? = null

    /** 子分类标记 */
    @ApiModelProperty(value = "子分类标记")
    @Column(name = "sub_flag")
    var subFlag: Boolean? = null

    /** 是否只读, 如果是则不允许对该信息点做变更 */
    @ApiModelProperty(value = "是否只读, 如果是则不允许对该信息点做变更")
    @Column(name = "readonly")
    var readonly: Boolean? = null

    /** 排序 */
    @ApiModelProperty(value = "排序")
    @Column(name = "sort")
    var sort: Int? = null

    /** 是否显示 */
    @ApiModelProperty(value = "是否显示")
    @Column(name = "visible")
    var visible: Boolean? = null

    /** 是否编辑 */
    @ApiModelProperty(value = "是否编辑")
    @Column(name = "editable")
    var editable: Boolean? = null

    /** 禁止操作 */
    @ApiModelProperty(value = "禁止操作")
    @Column(name = "un_disabled")
    var unDisabled: Boolean? = null

    /** 路径 */
    @ApiModelProperty(value = "路径")
    var path: String? = null
        get() {
            return if (firstName == "基本信息"|| firstName.isNullOrEmpty()){
                code
            }else{
                if (secondTag.isNullOrEmpty()){
                    "$firstTag.$code"
                }else{
                    "$firstTag.$secondTag.$code"
                }
            }
        }

} // Class DefFuncid