package cn.ibizlab.core.analysis.domain;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.enums.DEFieldDefaultValueType;
import cn.ibizlab.util.helper.DataObject;
import cn.ibizlab.util.enums.DupCheck;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.annotation.Audit;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;

/**
 * 实体[指标]
 */
@Getter
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZDAMETRIC", resultMap = "DAMetricResultMap")
public class DAMetric extends EntityMP implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 指标标识
     */
    @DEField(name = "da_metricid", isKeyField = true)
    @TableId(value = "da_metricid", type = IdType.ASSIGN_UUID)
    @JSONField(name = "metric_id")
    @JsonProperty("metric_id")
    private String metricId;
    /**
     * 指标名称
     */
    @DEField(name = "da_metricname")
    @TableField(value = "da_metricname")
    @JSONField(name = "metric_name")
    @JsonProperty("metric_name")
    private String metricName;
    /**
     * 类型
     */
    @TableField(value = "metrictype")
    @JSONField(name = "metric_type")
    @JsonProperty("metric_type")
    private String metricType;
    /**
     * 附加设置
     */
    @TableField(value = "extop")
    @JSONField(name = "ext_op")
    @JsonProperty("ext_op")
    private String extOp;
    /**
     * 参照列
     */
    @TableField(value = "refmetric")
    @JSONField(name = "ref_metric")
    @JsonProperty("ref_metric")
    private String refMetric;
    /**
     * 模型构建标识
     */
    @TableField(value = "buildid")
    @JSONField(name = "build_id")
    @JsonProperty("build_id")
    private String buildId;
    /**
     * 模型构建
     */
    @TableField(exist = false)
    @JSONField(name = "build_name")
    @JsonProperty("build_name")
    private String buildName;
    /**
     * 模型标识
     */
    @TableField(exist = false)
    @JSONField(name = "model_id")
    @JsonProperty("model_id")
    private String modelId;
    /**
     * 模型
     */
    @TableField(exist = false)
    @JSONField(name = "model_name")
    @JsonProperty("model_name")
    private String modelName;
    /**
     * 配置
     */
    @TableField(value = "cfg")
    @JSONField(name = "cfg")
    @JsonProperty("cfg")
    private String cfg;
    /**
     * 属性集合
     */
    @TableField(value = "fieldset")
    @JSONField(name = "field_set")
    @JsonProperty("field_set")
    private String fieldSet;
    /**
     * 建立时间
     */
    @DEField(preType = DEPredefinedFieldType.CREATEDATE)
    @TableField(value = "createdate", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @JSONField(name = "createdate", format = "yyyy-MM-dd HH:mm:ss")
    @JsonProperty("createdate")
    private Timestamp createdate;
    /**
     * 更新时间
     */
    @DEField(preType = DEPredefinedFieldType.UPDATEDATE)
    @TableField(value = "updatedate")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
    @JSONField(name = "updatedate", format = "yyyy-MM-dd HH:mm:ss")
    @JsonProperty("updatedate")
    private Timestamp updatedate;

    /**
     * 模型构建
     */
    @JsonIgnore
    @JSONField(serialize = false)
    @TableField(exist = false)
    private cn.ibizlab.core.analysis.domain.DABuild build;



    /**
     * 设置 [指标名称]
     */
    public void setMetricName(String metricName) {
        this.metricName = metricName;
        this.modify("da_metricname", metricName);
    }

    /**
     * 设置 [类型]
     */
    public void setMetricType(String metricType) {
        this.metricType = metricType;
        this.modify("metrictype", metricType);
    }

    /**
     * 设置 [附加设置]
     */
    public void setExtOp(String extOp) {
        this.extOp = extOp;
        this.modify("extop", extOp);
    }

    /**
     * 设置 [参照列]
     */
    public void setRefMetric(String refMetric) {
        this.refMetric = refMetric;
        this.modify("refmetric", refMetric);
    }

    /**
     * 设置 [模型构建标识]
     */
    public void setBuildId(String buildId) {
        this.buildId = buildId;
        this.modify("buildid", buildId);
    }

    /**
     * 设置 [配置]
     */
    public void setCfg(String cfg) {
        this.cfg = cfg;
        this.modify("cfg", cfg);
    }

    /**
     * 设置 [属性集合]
     */
    public void setFieldSet(String fieldSet) {
        this.fieldSet = fieldSet;
        this.modify("fieldset", fieldSet);
    }


    /**
     * 复制当前对象数据到目标对象(粘贴重置)
     * @param targetEntity 目标数据对象
     * @param bIncEmpty  是否包括空值
     * @param <T>
     * @return
     */
    @Override
    public <T> T copyTo(T targetEntity, boolean bIncEmpty) {
        this.reset("da_metricid");
        return super.copyTo(targetEntity, bIncEmpty);
    }
}


