package workflow

import (
	"github.com/shiningrush/fastflow/pkg/entity"
	"github.com/shiningrush/fastflow/pkg/entity/run"
	"github.com/shiningrush/fastflow/pkg/mod"
)

type Workflow interface {
	Close()

	// RegisterDag register a dag to workflow
	RegisterDag(dag *entity.Dag, actions []run.Action) error

	// RunDag start a dag instance
	RunDag(dagId string, specVar map[string]string) (*entity.DagInstance, error)
	// RunDagWithTags start a dag instance with tags
	RunDagWithTags(dagId string, specVar map[string]string, tags map[string]string) (*entity.DagInstance, error)
	// RetryDagIns retry a dag instance
	RetryDagIns(dagInsId string, ops ...mod.CommandOptSetter) error
	// CancelDagIns cancel a dag instance
	CancelDagIns(dagInsId string, ops ...mod.CommandOptSetter) error

	// ListDagIns list dag instances
	ListDagIns(input *mod.ListDagInstanceInput) ([]*entity.DagInstance, error)
}
