package enum

type RunStatus string

const (
	RunStatusPending         RunStatus = "pending"
	RunStatusQueued          RunStatus = "queued"
	RunStatusRunning         RunStatus = "running"
	RunStatusWaitingWorker   RunStatus = "waiting_worker"
	RunStatusCancelRequested RunStatus = "cancel_requested"
	RunStatusSucceeded       RunStatus = "succeeded"
	RunStatusFailed          RunStatus = "failed"
	RunStatusCancelled       RunStatus = "cancelled"
	RunStatusExpired         RunStatus = "expired"
)

func (s RunStatus) IsTerminal() bool {
	switch s {
	case RunStatusSucceeded, RunStatusFailed, RunStatusCancelled, RunStatusExpired:
		return true
	default:
		return false
	}
}

func (s RunStatus) IsCancellable() bool {
	switch s {
	case RunStatusPending, RunStatusQueued, RunStatusRunning, RunStatusWaitingWorker:
		return true
	default:
		return false
	}
}

type StepStatus string

const (
	StepStatusPending   StepStatus = "pending"
	StepStatusRunning   StepStatus = "running"
	StepStatusSucceeded StepStatus = "succeeded"
	StepStatusFailed    StepStatus = "failed"
	StepStatusSkipped   StepStatus = "skipped"
	StepStatusCancelled StepStatus = "cancelled"
)

type ConcurrencyPolicy string

const (
	ConcurrencyRejectSameScope ConcurrencyPolicy = "reject_same_scope"
	ConcurrencyAllowParallel   ConcurrencyPolicy = "allow_parallel"
	ConcurrencyReplaceExisting ConcurrencyPolicy = "replace_existing"
)

type WorkerType string

const (
	WorkerTypeGo WorkerType = "go"
)
