using NodePipeline.Application.Nodes;

namespace NodePipeline.Application;

public class FileImageProvider : IFileImageProvider
{
    private readonly Queue<string> _queue = [];

    public ImageBuffer GetNextImage()
    {
        return _queue.TryDequeue(out var filePath)
            ? ImageLoader.Load(filePath)
            : throw new Exception("Nothing to read");
    }

    public void AddNext(string filePath)
    {
        _queue.Enqueue(filePath);
    }
}