namespace marlin.core.models.meta; public class Recipe { public Recipe(string id) { this.Id = id; } public string Id { get; } public string Name { get; set; } public string? RunsOnId { get; set; } public List RequireIds { get; set; } = []; public Dictionary Steps { get; set; } = new(); public Dictionary Parameters { get; set; } = new(); public Dictionary Environment { get; set; } = new(); public RequirementSet? GetRunsOn(Workflow workflow) => this.RunsOnId != null ? workflow.Requirements[this.RunsOnId] : null; public IEnumerable GetRequires(Workflow workflow) => this.RequireIds.Select(id => workflow.Recipes[id]); public Dictionary CreateArguments() { Dictionary args = new(); foreach (var parameter in this.Parameters) args.Add(parameter.Key, parameter.Value); foreach (var environment in this.Environment) args.Add($"env.{environment.Key}", environment.Value); return args; } }