namespace AvParser.Core.Parsing;
///
/// The pluggable unit of the whole application: turns one input into a stream of outcomes.
///
///
/// Results are streamed rather than returned as a batch so that the UI can render partial
/// results, report progress and honour cancellation on inputs of arbitrary size.
///
public interface IParser
{
/// Stable identifier used for persistence and lookup. Never localise this.
string Id { get; }
/// Human-readable name shown in the UI.
string DisplayName { get; }
/// One-line explanation of what this parser accepts.
string Description { get; }
/// Cheap structural check — must not throw and must not do IO.
bool CanParse(TInput input);
///
/// Whether this parser makes network requests and therefore needs a working proxy.
///
///
/// A default implementation rather than an abstract member, so adding a parser stays a
/// one-line change: a parser that works on text the user pasted opts out by saying nothing.
/// Parsers that fetch anything must set this, or they will run direct even when the user has
/// asked for proxy-only operation.
///
bool RequiresNetwork => false;
/// Streams one outcome per logical record.
IAsyncEnumerable> ParseAsync(
TInput input,
IProgress? progress,
CancellationToken cancellationToken
);
}