package schema

import "gorm.io/gorm"

type RcuQuota struct {
	gorm.Model

	TenantID uint64 `gorm:"not null;index:idx_tenant_id,unique"`
	// Quota actually corresponds to InstanceMaxRCU in domain
	Quota       uint64 `gorm:"not null;default:50000;comment:Quota actually corresponds to the instance max RCU."`
	TotalMaxRCU uint64 `gorm:"not null;default:50000"`
	// BurstAllowancePercent represents the percentage allowance for bursting. For example, 20 means the actual usable RCU is 1.2 times the limit.
	BurstAllowancePercent      *uint32 `gorm:"not null;default:0;comment:Represents the percentage allowance for bursting. For example, 20 means the actual usable RCU is 1.2 times the limit."`
	ServicePlan                string  `gorm:"type:VARCHAR(255);index:idx_tenant_id,unique;default:''"`
	IdleResourcePoolTtlInHours uint32  `gorm:"not null;default:4"`
	VcpusLimitPerResourcePool  uint64  `gorm:"default:0"`
	MinimalRcuBaseline         uint64  `gorm:"not null;default:5000"`
	MinimalRcuCoefficient      float32 `gorm:"not null;default:0.25"`
	// ScaleDownCooldownMinutes is the cooldown period in minutes after a capacity change
	// during which scale-down of MaxRCU is not permitted. 0 means use the service default (720 min / 12 h).
	ScaleDownCooldownMinutes uint64 `gorm:"not null;default:720"`
}
