using System.Threading.Tasks;
using ClaudeDo.Ui.ViewModels;
using ClaudeDo.Ui.ViewModels.Conflicts;
using ClaudeDo.Ui.ViewModels.Modals;

namespace ClaudeDo.Ui.Services;

/// <summary>
/// Single seam for opening modal dialogs. Replaces the per-modal <c>Show*Modal</c>
/// Func callbacks that were previously wired separately on the shell and the lists
/// island (and the Confirm/Error dialogs duplicated in both code-behinds). The view
/// layer supplies the implementation (<see cref="ClaudeDo.Ui.Views.WindowDialogService"/>);
/// callers build + initialize the VM and hand it here to be shown.
/// </summary>
public interface IDialogService
{
    Task ShowAboutAsync(AboutModalViewModel vm);
    Task ShowWeeklyReportAsync(WeeklyReportModalViewModel vm);
    Task ShowUsageMonitorAsync(UsageMonitorModalViewModel vm);
    Task ShowSettingsAsync(SettingsModalViewModel vm);
    Task ShowListSettingsAsync(ListSettingsModalViewModel vm);
    Task ShowRepoImportAsync(RepoImportModalViewModel vm);
    Task ShowWorktreesOverviewAsync(WorktreesOverviewModalViewModel vm);

    /// <summary>Merge-helper task picker. Returns the ordered selected task ids, or null on cancel.</summary>
    Task<IReadOnlyList<string>?> ShowMergeHelperSelectionAsync(MergeHelperSelectionModalViewModel vm);
    Task ShowWorkerConnectionAsync(WorkerConnectionModalViewModel vm);
    Task ShowConflictResolverAsync(ConflictResolverViewModel vm);
    Task ShowLogVisualizerAsync(LogVisualizerViewModel vm);

    /// <summary>Modal yes/no confirmation. Returns true only when confirmed.</summary>
    Task<bool> ConfirmAsync(string message);

    /// <summary>Modal error notice with a single dismiss button.</summary>
    Task ShowErrorAsync(string message);

    /// <summary>Show (or re-show + focus) the modeless Mission Control window. Lazily created; hides on close.</summary>
    void ShowMissionControl(MissionControlViewModel vm);
}
