package resources

import (
	"time"

	"github.com/pingcap/dbaas/pkg/tidb/component"
	"github.com/tidbcloud/central-sdk/config"
)

// ClusterResources combines a Cluster and Resources
type ClusterResources struct {
	Provider     config.Cloud
	TenantID     uint64
	ProjectID    uint64
	ClusterID    uint64
	RegionName   string
	Zones        []string
	MySqlAddress string
	KeyID        string
	KmsArn       string
	Resources    []component.Resources
	NodesCIDR    string
	ClusterName  string
	CreatedAt    time.Time
	Replicas     uint32
}

func (cr *ClusterResources) TiFlashEnabled() bool {
	for _, c := range cr.Resources {
		if c.ComponentName == component.TiFlash {
			return true
		}
	}
	return false
}
