using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
namespace Inspectron.Epson;
///
/// Interface for Epson printer operations, allowing swappable implementations
/// (e.g., real printer vs HTML output for testing/preview)
///
public interface IEpsonPrinter : IAsyncDisposable
{
///
/// Returns true if connected to the printer
///
bool IsConnected { get; }
///
/// Connect to the printer
///
/// Printer IP address (or identifier for non-network implementations)
/// Printer port (default 9100)
/// Connection timeout in seconds (default 10)
Task ConnectAsync(string ip, int port = 9100, int timeoutSeconds = 10);
///
/// Disconnect from the printer
///
void Disconnect();
///
/// Get general printer status
///
Task GetPrinterStatusAsync();
///
/// Get offline status (reasons for offline)
///
Task GetOfflineStatusAsync();
///
/// Get error status
///
Task GetErrorStatusAsync();
///
/// Get paper sensor status
///
Task GetPaperSensorStatusAsync();
///
/// Get TM-T20/220 specific status byte
///
Task GetTM220StatusAsync();
///
/// Get printer model/ID
///
Task GetPrinterIdAsync();
///
/// Get comprehensive overall status with health assessment
///
Task GetOverallStatusAsync();
///
/// Initialize the printer
///
Task InitAsync();
///
/// Enable or disable quadruple size mode
///
Task SetQuadrupleMode(bool enable);
///
/// Enable or disable red color printing
///
Task SetRedColor(bool enable);
///
/// Enable or disable emphasized (bold) mode
///
Task SetEmphasized(bool enable);
///
/// Select printer font
///
Task SelectFont(EpsonCommands.PrinterFont font);
///
/// Enable or disable bigger font mode for TM-T20/220
///
Task SetBiggerFontTM220(bool enabled);
///
/// Print text to the printer
///
Task PrintTextAsync(string text);
///
/// Set font size (magnification)
///
/// Width magnification (1-8)
/// Height magnification (1-8)
Task SetFontSizeAsync(int width, int height);
///
/// Print text, feed paper, and cut
///
Task PrintTextAndCutAsync(string text, int feedLines = 5);
///
/// Print the current buffer
///
Task PrintBuffer();
///
/// Feed specified number of lines
///
Task FeedLinesAsync(int lines);
///
/// Cut the paper
///
Task CutAsync();
///
/// Load an image from a file path into the printer buffer
///
Task LoadImageAsync(string imagePath, int maxWidth = 384);
///
/// Load an image from a stream into the printer buffer
///
Task LoadImageAsync(Stream imageStream, int maxWidth = 384);
///
/// Load an image from an ImageSharp Image object into the printer buffer
///
Task LoadImageAsync(Image image, int maxWidth = 384);
///
/// Print the previously loaded image
///
Task PrintLoadedImage();
///
/// Print an image using bit-image mode from a file path
///
Task PrintImageBitModeAsync(string imagePath, EpsonCommands.BitImageMode mode = EpsonCommands.BitImageMode.SingleDensity8Dot, int maxWidth = 10);
///
/// Print an image using bit-image mode from a stream
///
Task PrintImageBitModeAsync(Stream imageStream, EpsonCommands.BitImageMode mode = EpsonCommands.BitImageMode.DoubleDensity24Dot, int maxWidth = 384);
///
/// Print an image using bit-image mode from an ImageSharp Image object
///
Task PrintImageBitModeAsync(Image image, EpsonCommands.BitImageMode mode, int maxWidth);
///
/// Send raw ESC/POS command bytes to the printer
///
Task SendRawCommandAsync(byte[] command);
///
/// Set the absolute horizontal print position
///
Task SetAbsolutePrintPosition(int x);
///
/// Set default line spacing
///
Task SetDefaultLineSpacing();
///
/// Set custom line spacing
///
Task SetCustomLineSpacing(int spacing = 24);
}