package cn.ibizlab.core.rule.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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;


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 = "IBZRULE", resultMap = "RuleItemResultMap")
@ApiModel("规则")
public class RuleItem extends EntityMP implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 规则标识
     */
    @DEField(isKeyField = true)
    @TableId(value = "ruleid", type = IdType.ASSIGN_UUID)
    @JSONField(name = "rule_id")
    @JsonProperty("rule_id")
    @ApiModelProperty("规则标识")
    private String ruleId;
    /**
     * 名称
     */
    @TableField(value = "rulename")
    @JSONField(name = "rule_name")
    @JsonProperty("rule_name")
    @ApiModelProperty("名称")
    private String ruleName;
    /**
     * 规则分组
     */
    @DEField(name = "rulegroup")
    @TableField(value = "rulegroup")
    @JSONField(name = "group")
    @JsonProperty("group")
    @ApiModelProperty("规则分组")
    private String group;
    /**
     * 业务类别
     */
    @TableField(value = "businesscat")
    @JSONField(name = "business_cat")
    @JsonProperty("business_cat")
    @ApiModelProperty("业务类别")
    private String businessCat;
    /**
     * 模型标识
     */
    @TableField(value = "modelid")
    @JSONField(name = "model_id")
    @JsonProperty("model_id")
    @ApiModelProperty("模型标识")
    private String modelId;
    /**
     * 模型
     */
    @TableField(value = "modelname")
    @JSONField(name = "model_name")
    @JsonProperty("model_name")
    @ApiModelProperty("模型")
    private String modelName;
    /**
     * 配置
     */
    @TableField(value = "cfg")
    @JSONField(name = "cfg")
    @JsonProperty("cfg")
    @ApiModelProperty("配置")
    private String cfg;
    /**
     * 属性集合
     */
    @TableField(value = "fieldset")
    @JSONField(name = "field_set")
    @JsonProperty("field_set")
    @ApiModelProperty("属性集合")
    private String fieldSet;
    /**
     * 备注
     */
    @TableField(value = "memo")
    @JSONField(name = "memo")
    @JsonProperty("memo")
    @ApiModelProperty("备注")
    private String memo;
    /**
     * 规则码
     */
    @TableField(value = "rulecode")
    @JSONField(name = "rule_code")
    @JsonProperty("rule_code")
    @ApiModelProperty("规则码")
    private String ruleCode;
    /**
     * 自定义
     */
    @TableField(value = "custag")
    @JSONField(name = "cus_tag")
    @JsonProperty("cus_tag")
    @ApiModelProperty("自定义")
    private Integer cusTag;
    /**
     * 条件
     */
    @TableField(value = "cond")
    @JSONField(name = "cond")
    @JsonProperty("cond")
    @ApiModelProperty("条件")
    private String cond;
    /**
     * 建立时间
     */
    @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")
    @ApiModelProperty("建立时间")
    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")
    @ApiModelProperty("更新时间")
    private Timestamp updatedate;
    /**
     * 系统标识
     */
    @TableField(exist = false)
    @JSONField(name = "system_id")
    @JsonProperty("system_id")
    @ApiModelProperty("系统标识")
    private String systemId;

    /**
     * 模型
     */
    @JsonIgnore
    @JSONField(serialize = false)
    @TableField(exist = false)
    private cn.ibizlab.core.lite.domain.MetaModel model;



    /**
     * 设置 [名称]
     */
    public void setRuleName(String ruleName) {
        this.ruleName = ruleName;
        this.modify("rulename", ruleName);
    }

    /**
     * 设置 [规则分组]
     */
    public void setGroup(String group) {
        this.group = group;
        this.modify("rulegroup", group);
    }

    /**
     * 设置 [业务类别]
     */
    public void setBusinessCat(String businessCat) {
        this.businessCat = businessCat;
        this.modify("businesscat", businessCat);
    }

    /**
     * 设置 [模型标识]
     */
    public void setModelId(String modelId) {
        this.modelId = modelId;
        this.modify("modelid", modelId);
    }

    /**
     * 设置 [模型]
     */
    public void setModelName(String modelName) {
        this.modelName = modelName;
        this.modify("modelname", modelName);
    }

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

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

    /**
     * 设置 [备注]
     */
    public void setMemo(String memo) {
        this.memo = memo;
        this.modify("memo", memo);
    }

    /**
     * 设置 [规则码]
     */
    public void setRuleCode(String ruleCode) {
        this.ruleCode = ruleCode;
        this.modify("rulecode", ruleCode);
    }

    /**
     * 设置 [自定义]
     */
    public void setCusTag(Integer cusTag) {
        this.cusTag = cusTag;
        this.modify("custag", cusTag);
    }

    /**
     * 设置 [条件]
     */
    public void setCond(String cond) {
        this.cond = cond;
        this.modify("cond", cond);
    }


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


