package spec

import (
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

	"github.com/tidbcloud/eks-provider/api/v1alpha1"
	cloudv1 "github.com/tidbcloud/infra-api/api/v1"
	"github.com/tidbcloud/infra-provider/pkg/controllers/common"
)

const ClusterTagLabelKey = cloudv1.TagLabelPrefix + common.Cluster
const ComponentTagLabelKey = cloudv1.TagLabelPrefix + common.Component
const UseByTagLabelKey = cloudv1.TagLabelPrefix + common.UsedBy

func GetTiDBClusterNameLabel(meta *metav1.ObjectMeta) map[string]string {
	labels := map[string]string{}
	labels[v1alpha1.TiDBClusterNameLabelKey] = GetTiDBClusterName(meta)
	return labels
}

func GetTiDBClusterName(meta *metav1.ObjectMeta) string {
	return meta.Labels[v1alpha1.TiDBClusterNameLabelKey]
}
