#nullable enable
namespace Terminal.Gui.Drivers;
///
/// Interface for main loop class that will process the queued input buffer contents.
/// Is responsible for and translating into common Terminal.Gui
/// events and data models.
///
public interface IInputProcessor
{
/// Event fired when a key is pressed down. This is a precursor to .
event EventHandler? KeyDown;
/// Event fired when a key is released.
///
/// Drivers that do not support key release events will fire this event after processing is
/// complete.
///
event EventHandler? KeyUp;
/// Event fired when a terminal sequence read from input is not recognized and therefore ignored.
public event EventHandler? AnsiSequenceSwallowed;
/// Event fired when a mouse event occurs.
event EventHandler? MouseEvent;
///
/// Gets the name of the driver associated with this input processor.
///
string? DriverName { get; init; }
///
/// Called when a key is pressed down. Fires the event. This is a precursor to
/// .
///
/// The key event data.
void OnKeyDown (Key key);
///
/// Called when a key is released. Fires the event.
///
///
/// Drivers that do not support key release events will call this method after processing
/// is complete.
///
/// The key event data.
void OnKeyUp (Key key);
///
/// Called when a mouse event occurs. Fires the event.
///
/// The mouse event data.
void OnMouseEvent (MouseEventArgs mouseEventArgs);
///
/// Drains the input buffer, processing all available keystrokes
///
void ProcessQueue ();
///
/// Gets the response parser currently configured on this input processor.
///
///
public IAnsiResponseParser GetParser ();
///
/// Handles surrogate pairs in the input stream.
///
/// The key from input.
/// Get the surrogate pair or the key.
///
/// if the result is a valid surrogate pair or a valid key, otherwise
/// .
///
bool IsValidInput (Key key, out Key result);
}