namespace ScadaLink.CentralUI.Components.Shared;

/// <summary>
/// Centralised dialog/modal service. Pages inject this service and call
/// <see cref="ConfirmAsync"/> or <see cref="PromptAsync"/> programmatically
/// instead of embedding per-page modal components. A single <c>DialogHost</c>
/// rendered in <c>MainLayout</c> displays the resulting dialog state.
/// </summary>
public interface IDialogService
{
    /// <summary>
    /// Shows a confirmation dialog and resolves to <c>true</c> when the user
    /// confirms, or <c>false</c> when the user cancels (button click, Escape,
    /// or backdrop dismiss).
    /// </summary>
    /// <param name="title">Modal title text.</param>
    /// <param name="message">Body text shown to the user.</param>
    /// <param name="danger">When <c>true</c>, the confirm button renders in
    /// <c>btn-danger</c> styling with the label "Delete"; otherwise a primary
    /// "Confirm" button is shown.</param>
    Task<bool> ConfirmAsync(string title, string message, bool danger = false);

    /// <summary>
    /// Shows a single-line text prompt and resolves to the entered value, or
    /// <c>null</c> if the user cancels.
    /// </summary>
    /// <param name="title">Modal title text.</param>
    /// <param name="label">Label rendered above the input field.</param>
    /// <param name="initialValue">Pre-populated value for the input field.</param>
    /// <param name="placeholder">Optional placeholder shown when the input is empty.</param>
    Task<string?> PromptAsync(string title, string label, string initialValue = "", string? placeholder = null);
}
