namespace Triforce.Launcher.Host;
/// The window the page lives in. Windows: WinHost (WebView2 in our own frameless window). Linux: LinuxHost
/// (Photino, WebKitGTK, the desktop's own window frame).
public interface IHost
{
/// Opens the window on the page and returns when it closes. Call on the thread that made the host.
void Run();
/// Sends one JSON message to the page. Any thread.
void Post(string json);
/// Runs an action on the window's thread.
void Invoke(Action a);
/// A message from the page: its JSON, and the full paths of any files dropped with it (Windows hands those over
/// with the drop; Linux hands over file:// links in the JSON instead).
event Action Message;
void Minimize();
void ToggleMaximize();
void Close();
void Activate();
/// Asks for the player's eye without taking the focus (Windows: the taskbar button flashes until the window is
/// in front; Linux: a desktop notification).
void Attention(string title, string text);
/// The system's file picker. Null when cancelled.
string? PickFile(string title, string filterName, string pattern);
string? PickFolder(string title);
/// True when the page draws the title bar itself (Windows); false when the desktop draws it (Linux).
bool CustomChrome { get; }
/// Where the page is served from, e.g. https://app.triforce/ (ends with a slash).
string Origin { get; }
}