package common

import (
	"fmt"

	. "github.com/tidbcloud/dataflow-service-e2e/internal/model"
)

const (
	EssentialServicePlan = "Essential"
	EssentialMinRCU      = int64(2000)
	EssentialMaxRCU      = int64(4000)
)

// ValidateCluster is the shared dependency assertion for every Essential
// lifecycle case. It deliberately validates the real Serverless entity.
func ValidateCluster(cluster *TiDBServerlessEntity) error {
	if cluster == nil {
		return fmt.Errorf("Essential cluster dependency is nil")
	}
	if cluster.ServicePlan != EssentialServicePlan {
		return fmt.Errorf("cluster %s has service plan %q, want %q", cluster.ClusterID, cluster.ServicePlan, EssentialServicePlan)
	}
	return nil
}
