summaryrefslogtreecommitdiff
path: root/src/marlin.core/models/meta/RecipeStep.cs
blob: afe77cf4984a3f4aff1433258a832e317ed97dfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
namespace marlin.core.models.meta;

public class RecipeStep : AbstractStep
{
    public RecipeStep(string id) : base(id)
    {
    }

    public string? BaseId { get; set; }
    public CleanupStep? Cleanup { get; set; }
    public Dictionary<string, Artifact> Artifacts { get; set; } = new();
    public List<string> Ingest { get; set; } = new();

    public RecipeStep? GetBase(Workflow workflow) =>
        this.BaseId != null ? workflow.Steps[this.BaseId] : null;

    public override IEnumerable<AbstractStep> GetAncestorsAndThis(Workflow workflow)
    {
        yield return this;

        var step = this.GetBase(workflow);
        while (step != null)
        {
            yield return step;
            step = step.GetBase(workflow);
        }
    }
}