package gcp

import (
	"github.com/shiningrush/fastflow/pkg/entity"
	"github.com/shiningrush/fastflow/pkg/entity/run"
	"github.com/tidbcloud/dataflow-service/app/container"
	"github.com/tidbcloud/dataflow-service/app/workflow"
	bucket_create "github.com/tidbcloud/dataflow-service/app/workflow/action/bucket/create"
	"github.com/tidbcloud/dataflow-service/app/workflow/action/bucket/create/gcp"
)

//nolint:gomnd
func GetCreateBucketDag() (*entity.Dag, []run.Action) {
	actions := []run.Action{
		gcp.NewCreateBucketAction(
			container.Global().TransProvider,
			container.Global().BucketRepo,
			container.Global().GCPBucketManagerModel,
		),
		bucket_create.NewCreateBucketFinalAction(
			container.Global().TransProvider,
			container.Global().BucketRepo,
		),
	}

	dag := &entity.Dag{
		BaseInfo: entity.BaseInfo{
			ID: workflow.DagCreateBucketGCP,
		},
		Name: workflow.DagCreateBucketGCP,
		Vars: entity.DagVars{
			workflow.KeyBucketID: {},
		},
		Status: entity.DagStatusNormal,
		Tasks: []entity.Task{
			{
				ID:          workflow.ActionCreateBucketGCP,
				ActionName:  workflow.ActionCreateBucketGCP,
				TimeoutSecs: 60 * 3,
			},
			{
				ID:          workflow.ActionCreateBucketFinalStep,
				ActionName:  workflow.ActionCreateBucketFinalStep,
				TimeoutSecs: 60,
				DependOn: []string{
					workflow.ActionCreateBucketGCP,
				},
			},
		},
	}
	return dag, actions
}
