#nullable enable
namespace Terminal.Gui;
///
/// When implemented in a derived class, allows watching an input stream of characters
/// (i.e. console input) for ANSI response sequences (mouse input, cursor, query responses etc.).
///
public interface IAnsiResponseParser
{
///
/// Current state of the parser based on what sequence of characters it has
/// read from the console input stream.
///
AnsiResponseParserState State { get; }
///
/// Notifies the parser that you are expecting a response to come in
/// with the given (i.e. because you have
/// sent an ANSI request out).
///
/// The terminator you expect to see on response.
/// Callback to invoke when the response is seen in console input.
///
///
/// if you want this to persist permanently
/// and be raised for every event matching the .
///
///
/// If trying to register a persistent request for a terminator
/// that already has one.
/// exists.
///
void ExpectResponse (string? terminator, Action response, Action? abandoned, bool persistent);
///
/// Returns true if there is an existing expectation (i.e. we are waiting a response
/// from console) for the given .
///
///
///
bool IsExpecting (string? terminator);
///
/// Removes callback and expectation that we will get a response for the
/// given . Use to give up on very old
/// requests e.g. if you want to send a different one with the same terminator.
///
///
///
/// if you want to remove a persistent
/// request listener.
///
void StopExpecting (string? requestTerminator, bool persistent);
}