package model

import "time"

type Cluster struct {
	ID                int64     `gorm:"primaryKey;autoIncrement"`
	OrgID             string    `gorm:"size:200"`
	ClusterID         string    `gorm:"size:255;uniqueIndex"`
	ClusterName       string    `gorm:"size:255"`
	MetricsRouting    string    `gorm:"size:255"`
	Alias             string    `gorm:"size:255"`
	ProjectID         string    `gorm:"size:100"`
	Region            string    `gorm:"size:100"`
	Provider          string    `gorm:"size:64"`
	DeployType        string    `gorm:"size:64"`
	SkipCheck         bool      `gorm:"not null"`
	ApplicationID     string    `gorm:"size:255"`
	DataplaneID       string    `gorm:"size:255"`
	PhysicalClusterID string    `gorm:"size:255"`
	CreatedAt         time.Time `gorm:"type:datetime(3)"`
	UpdatedAt         time.Time `gorm:"type:datetime(3)"`

	// 非持久化字段：API 请求传入的 Prometheus URL（不存入数据库）
	ClusterMetricsURL    string `gorm:"-" json:"-"`
	DataPlaneMetricsURL  string `gorm:"-" json:"-"`
}

func (Cluster) TableName() string { return "clusters" }

type PromSql struct {
	ID        int64     `gorm:"primaryKey;autoIncrement"`
	Name      string    `gorm:"size:255;uniqueIndex"`
	Interval  string    `gorm:"size:50"`
	Query     string    `gorm:"size:255"`
	Type      string    `gorm:"size:50"`
	IsSkip    bool      `gorm:"not null"`
	CreatedAt time.Time `gorm:"type:datetime(3)"`
	UpdatedAt time.Time `gorm:"type:datetime(3)"`
}
