package master

import (
	"github.com/tidbcloud/eks-provider/api/v1alpha1"
	"github.com/tidbcloud/eks-provider/controllers/tiflow/task"
	"github.com/tidbcloud/eks-provider/controllers/tiflow/task/cluster"
	"github.com/tidbcloud/infra-provider/pkg/k8s"
	"github.com/tidbcloud/infra-provider/pkg/namer"
)

type Context struct {
	*cluster.BaseContext

	TiflowClusterMaster *v1alpha1.TiflowClusterMaster
}

func (c *Context) Default() *Context {
	c.Remote = &k8s.EmptyGetter{}
	c.Namer = namer.NewTiflowNamer().
		WithNetworkName(c.Network.Name).
		WithNetworkNamespace(c.Network.Namespace).
		WithTiflowClusterName(c.TiflowClusterMaster.Name).
		WithTiflowNamespace(task.GetTiflowNamespace(c.Network)).
		WithTiflowSpecLabel(c.TiflowSpec.SpecCode)
	return c
}
