package dag

import (
	"fmt"

	"github.com/tidbcloud/fastflow/pkg/entity"

	"github.com/tidbcloud/tidb-management-service/serverless-global-service/domain/service/workflow/action"
	"github.com/tidbcloud/tidb-management-service/serverless-global-service/domain/service/workflow/common"
	"github.com/tidbcloud/tidb-management-service/utilities/workflow"
)

func NewDeleteClusterDag() *entity.Dag {
	dag := &entity.Dag{
		BaseInfo: entity.BaseInfo{
			ID: common.DeleteCluster,
		},
		Name:   common.DeleteCluster,
		Status: entity.DagStatusNormal,
		Vars: map[string]entity.DagVar{
			workflow.KeyTraceId:     {},
			common.KeyClusterId:     {},
			workflow.KeyRequestMeta: {},
		},
		Tasks: []entity.Task{
			{
				ID:         action.DeleteCluster,
				ActionName: action.DeleteCluster,
				Params: map[string]any{
					common.KeyClusterId: fmt.Sprintf("{{%s}}", common.KeyClusterId),
				},
			},
		},
	}

	return dag
}
