using NodePipeline.Configuration.Abstractions.Models.Execute;

namespace NodePipeline.Engine.Graph;

public static class PipelineGraphBuilder
{
    public static Dictionary<string, List<string>> Build(PipelineConfig config)
    {
        var graph = new Dictionary<string, List<string>>();
        foreach (var node in config.Nodes)
            graph[node.Id] = [];
        foreach (var node in config.Nodes)
        foreach (var inp in node.Inputs.Values)
            graph[inp.NodeId].Add(node.Id);

        return graph;
    }
}