package dag

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

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

func CreateManualBackupDag() *entity.Dag {
	dag := &entity.Dag{
		BaseInfo: entity.BaseInfo{
			ID: common.CreateManualBackup,
		},
		Name:   common.CreateManualBackup,
		Status: entity.DagStatusNormal,
		Vars: map[string]entity.DagVar{
			common.KeyRequest:       {},
			workflow.KeyTraceId:     {},
			workflow.KeyRequestMeta: {},
		},
		Tasks: []entity.Task{
			{
				ID:         action.CreateManualBackup,
				ActionName: action.CreateManualBackup,
			},
			{
				ID:         action.PollManualBackupFinished,
				ActionName: action.PollManualBackupFinished,
				DependOn:   []string{action.CreateManualBackup},
			},
		},
	}

	return dag
}
