namespace Terminal.Gui.App;
///
/// Defines a runnable view that captures exclusive input (modal behavior) and returns a result.
///
///
/// The type of result data returned when the modal is accepted.
/// Common types: for button indices, for file paths,
/// custom types for complex form data.
///
///
///
/// Modal runnables block execution of until stopped,
/// capture all keyboard and mouse input exclusively, and typically have elevated Z-order.
///
///
/// When is null, the modal was stopped without being accepted
/// (e.g., ESC key pressed, window closed). When non-null, it contains the result data
/// that was extracted from the Accept command before the modal's subviews were disposed.
///
///
/// Common implementations include , , and .
///
///
/// For modals that need to provide additional context or data upon completion, populate the result
/// before setting it. By default (except for s with set),
/// if a modal does not handle the Accept command, will be null (canceled).
///
///
public interface IModalRunnable : IRunnable
{
///
/// Gets or sets the result data from the modal operation.
///
///
///
/// Implementations should set this property when the modal is accepted (e.g., OK button clicked,
/// file selected). The result should be extracted from the modal's state before views are disposed.
///
///
/// For value types (like ), implementations should use a nullable type (e.g., int?)
/// where null indicates the modal was stopped without accepting.
/// For reference types, null similarly indicates cancellation.
///
///
/// Examples:
/// - : Implement with IModalRunnable<int?>, returns button index or null
/// - : Implement with IModalRunnable<int?>, returns button index or null
/// - : Implement with IModalRunnable<string?>, returns file path or null
///
///
TResult Result { get; set; }
}