package controlplane

import (
	"time"

	"github.com/tidbcloud/devops/models/base"
)

type Deployment struct {
	base.Updatable

	Scenario       string     `gorm:"type:VARCHAR(64);not null"`
	Phase          string     `gorm:"type:VARCHAR(64);not null;index:idx_phase"`
	Applicant      string     `gorm:"type:VARCHAR(255);not null"`
	Params         []byte     `gorm:"type:JSON"`
	FrozenSnapshot []byte     `gorm:"type:JSON"`
	PreviewMeta    []byte     `gorm:"type:JSON"`
	ApplyMeta      []byte     `gorm:"type:JSON"`
	ApprovalID     *base.ID   `gorm:"index:idx_approval_id"`
	ClosedAt       *time.Time `gorm:"type:TIMESTAMP"`
}

func (Deployment) TableName() string {
	return "deployments"
}
