using System.Threading.Channels;
using Inspectron.Epson.Queue;

namespace Inspectron.Epson.PrintServer.JobSources;

public class SingleJobSource: IPrintJobSource
{
    public SingleJobSource(PrintJob job)
    {
        _channel.Writer.WriteAsync(job);
    }

    private Channel<PrintJob> _channel = Channel.CreateUnbounded<PrintJob>();
    public async Task<PrintJob> GetNextJobAsync(CancellationToken cancellationToken)
    {
        return await _channel.Reader.ReadAsync(cancellationToken);
    }
}

