package predict_edb_conf

import (
	"time"
)

// PredictEdbConf 预测指标规则配置表
type PredictEdbConf struct {
	ConfigID         uint64    `gorm:"primaryKey;column:config_id;type:bigint(9) unsigned;not null" json:"-"`                         // 规则id
	PredictEdbInfoID uint64    `gorm:"column:predict_edb_info_id;type:bigint(9) unsigned;not null;default:0" json:"predictEdbInfoId"` // 预测指标id
	SourceEdbInfoID  uint64    `gorm:"column:source_edb_info_id;type:bigint(9) unsigned;default:0" json:"sourceEdbInfoId"`            // 来源指标id
	RuleType         uint8     `gorm:"column:rule_type;type:tinyint(9) unsigned;default:1" json:"ruleType"`                           // 预测规则，1：最新，2：固定值
	FixedValue       float64   `gorm:"column:fixed_value;type:decimal(38,4)" json:"fixedValue"`                                       // 固定值
	Value            string    `gorm:"column:value;type:varchar(255);default:''" json:"value"`                                        // 配置的值
	EndDate          time.Time `gorm:"column:end_date;type:date" json:"endDate"`                                                      // 截止日期
	ModifyTime       time.Time `gorm:"column:modify_time;type:datetime;default:CURRENT_TIMESTAMP" json:"modifyTime"`                  // 修改时间
	CreateTime       time.Time `gorm:"column:create_time;type:datetime" json:"createTime"`                                            // 添加时间
}

// TableName get sql table name.获取数据库表名
func (m *PredictEdbConf) TableName() string {
	return "predict_edb_conf"
}

// PredictEdbConfColumns get sql column name.获取数据库列名
var PredictEdbConfColumns = struct {
	ConfigID         string
	PredictEdbInfoID string
	SourceEdbInfoID  string
	RuleType         string
	FixedValue       string
	Value            string
	EndDate          string
	ModifyTime       string
	CreateTime       string
}{
	ConfigID:         "config_id",
	PredictEdbInfoID: "predict_edb_info_id",
	SourceEdbInfoID:  "source_edb_info_id",
	RuleType:         "rule_type",
	FixedValue:       "fixed_value",
	Value:            "value",
	EndDate:          "end_date",
	ModifyTime:       "modify_time",
	CreateTime:       "create_time",
}
