package model

// KpiCTitle 自定义指标标题信息对象 kpi_title
type KpiCTitle struct {
	ID          int64  `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
	NeType      string `json:"neType" gorm:"column:ne_type"`
	KpiId       string `json:"kpiId" gorm:"column:kpi_id"`
	Title       string `json:"title" gorm:"column:title"`
	Expression  string `json:"expression" gorm:"column:expression"`
	Unit        string `json:"unit" gorm:"column:unit"`
	Status      string `json:"status" gorm:"column:status"` // 0-Inactive/1-Active/2-Deleted
	Description string `json:"description" gorm:"column:description"`
	CreatedBy   string `json:"createdBy" gorm:"column:created_by"`
	UpdatedAt   int64  `json:"updatedAt" gorm:"column:updated_at"`
}

// TableName 表名称
func (*KpiCTitle) TableName() string {
	return "kpi_c_title"
}

// KpiCReport 自定义指标报表信息对象
type KpiCReport struct {
	ID          int64  `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
	NeType      string `json:"neType" gorm:"column:ne_type"`
	NeName      string `json:"neName" gorm:"column:ne_name"`
	RmUid       string `json:"rmUid" gorm:"column:rm_uid"`
	Date        string `json:"date" gorm:"column:date"`               // Date of the report yyyy-mm-dd hh:mi:ss
	StartTime   string `json:"startTime" gorm:"column:start_time"`    // Start time of the report hh:mi:ss
	EndTime     string `json:"endTime" gorm:"column:end_time"`        // End time of the report hh:mi:ss
	Index       int64  `json:"index" gorm:"column:index"`             // Index of the report
	Granularity int64  `json:"granularity" gorm:"column:granularity"` // Time granualarity: 5/10/.../60/300 (second)
	KpiValues   string `json:"kpiValues" gorm:"column:kpi_values"`    // KPI values JSON String
	CreatedAt   int64  `json:"createdAt" gorm:"column:created_at"`    // Creation time
}

// TableName 表名称
func (*KpiCReport) TableName() string {
	return "kpi_c_report"
}

// KPICQuery 指标查询参数结构体
type KPICQuery struct {
	NeType    string `form:"neType" binding:"required"`
	NeID      string `form:"neId" binding:"required"`
	BeginTime int64  `form:"beginTime" binding:"required"` // 开始时间戳（毫秒）1739361200999
	EndTime   int64  `form:"endTime" binding:"required"`   // 结束时间戳（毫秒）1739361210088
	Interval  int64  `form:"interval" binding:"required,oneof=5 60 300 900 1800 3600"`
	RmUID     string `form:"rmUID"`
	SortField string `form:"sortField" binding:"omitempty,oneof=timeGroup"`
	SortOrder string `form:"sortOrder" binding:"omitempty,oneof=asc desc"`
}
