package userbehavior

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

type Subscription struct {
	base.Updatable

	Name              string      `gorm:"type:VARCHAR(255);not null"`
	SubscribeType     string      `gorm:"type:VARCHAR(255);not null"`
	LarkChats         []*LarkChat `gorm:"many2many:subscriptions_larkchats"`
	EventType         string      `gorm:"type:VARCHAR(255);not null"`
	Template          string      `gorm:"type:VARCHAR(1000);not null"`
	TenantSelector    string      `gorm:"type:VARCHAR(255);not null"`
	BizRegionSelector string      `gorm:"type:VARCHAR(255);not null"`

	Creator string `gorm:"type:VARCHAR(255);not null"` // Creator email

	Available            bool `gorm:"default:false;not null"`
	OnlyPaidTenant       bool `gorm:"default:false;not null"`
	OnlyExternalTenant   bool `gorm:"default:false; not null"`
	OnlyDedicatedCluster bool `gorm:"default:false; not null"`

	DetailLink *string `gorm:"type:VARCHAR(1024);default null"`
	TextFilter string  `gorm:"type:VARCHAR(1024);not null;default '' "`
}

func (Subscription) TableName() string {
	return "userbehavior_subscriptions"
}
