package master

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

	eksv1alpha1 "github.com/tidbcloud/eks-provider/api/v1alpha1"
	"github.com/tidbcloud/eks-provider/controllers/tiflow/task"
	"github.com/tidbcloud/infra-provider/pkg/deploy"
)

const (
	TiflowSpecLabelKey string = "tiflow-spec"
)

type BaseTask struct {
	task.BaseTask
	*Context
}

func (t *BaseTask) Category() deploy.TaskCategory {
	return deploy.TiflowClusterMasterTask
}

func (t *BaseTask) GetPrivateLinkEndpointName() string {
	return t.Namer.GetTiflowClusterName()
}

func (t *BaseTask) GetPrivateLinkEndpointMetaObject() *eksv1alpha1.PrivateLinkEndpoint {
	return &eksv1alpha1.PrivateLinkEndpoint{
		ObjectMeta: metav1.ObjectMeta{
			Name:      t.GetPrivateLinkEndpointName(),
			Namespace: t.TiflowClusterMaster.Namespace,
		},
	}
}
