namespace Chronos.App.Infrastructure;
/// Texts of a confirmation dialog (DESIGN §4: two buttons, safe action left and default).
public sealed record ConfirmRequest
{
public required string Heading { get; init; }
public required string Message { get; init; }
/// Detail block (certificate fingerprint, list of what changes); null hides it.
public string? Detail { get; init; }
/// The detail is set in the monospaced font (fingerprints, values to compare); false sets it in the UI font (names, sentences).
public bool IsDetailMonospaced { get; init; } = true;
public string? DetailToolTip { get; init; }
public required string SafeText { get; init; }
public required string SafeToolTip { get; init; }
public required string ActionText { get; init; }
public required string ActionToolTip { get; init; }
/// Warning-outlined action (never a primary) for data-destroying choices.
public bool IsDestructive { get; init; }
/// Text the user must type before the action enables (formatting a card: its name); null asks no typing.
public string? TypedConfirmation { get; init; }
/// Label of the typing field ("Type the card name to confirm").
public string? TypedPrompt { get; init; }
}
/// Modal questions and OS pickers the view models ask for (BRIEF §12.1: modals only for confirmations and login).
public interface IAppDialogs
{
/// A folder chosen in the shell's folder picker; null when cancelled.
string? PickFolder(string title, string? initialFolder = null);
/// A JSON file chosen in the shell's Open dialog; null when cancelled.
string? PickJsonFile(string title);
/// True when the user chose the action.
bool Confirm(ConfirmRequest request);
///
/// The login form. receives user and password and returns null on success or the
/// error sentence to show; the form stays open until it succeeds or the user cancels. True when signed in.
///
bool SignIn(string server, string? username, Func> signIn);
}