package models

import (
	"github.com/bluesky-social/indigo/atproto/syntax"

	"tangled.org/core/api/tangled"
)

type Pipeline struct {
	RepoDid   syntax.DID
	Workflows map[Engine][]Workflow
	// whether the code being ran was checked out from RepoDid itself
	TrustedSource bool
	// used to resolve cache hash files against the checkout the workflow builds
	TriggerMetadata *tangled.Pipeline_TriggerMetadata
}

type Step interface {
	Name() string
	Command() string
	Kind() StepKind
}

type StepKind int

const (
	// steps injected by the CI runner
	StepKindSystem StepKind = iota
	// steps defined by the user in the original pipeline
	StepKindUser
)

type Workflow struct {
	Steps       []Step
	Name        string
	Data        any
	Environment map[string]string
	Caches      []CacheEntry
	Engine      string
}
