using Inspectron.Epson;

namespace EpsonPrintService;

/// <summary>
/// Simple console implementation that logs discovered printers to the console
/// </summary>
public class ConsoleDiscoveredPrintersReceiver : IDiscoveredPrintersReceiver
{
    public Task OnPrintersDiscoveredAsync(IReadOnlyList<DiscoveredPrinter> printers)
    {
        Console.WriteLine($"[{DateTime.Now:HH:mm:ss}] Discovered printers changed. Found {printers.Count} printer(s):");

        foreach (var printer in printers)
        {
            Console.WriteLine($"  - {printer.IPAddress}");
        }

        if (printers.Count == 0)
        {
            Console.WriteLine("  (no printers found)");
        }

        return Task.CompletedTask;
    }
}
