using System.Windows;
using NexusShell.Models;

namespace NexusShell.Controls.Dialogs;

public sealed class NexusOpenWithDialog
{
    public string Title { get; set; } = "Åbn med";
    public string? FilePath { get; set; }
    public NexusDefaultAppId? SelectedApp { get; private set; }

    public bool? ShowDialog(Window? owner = null)
    {
        if (string.IsNullOrWhiteSpace(FilePath))
        {
            return false;
        }

        var window = new NexusOpenWithDialogWindow
        {
            Owner = owner,
            DialogTitle = Title,
            FilePath = FilePath,
        };

        var result = window.ShowDialog();
        if (result == true)
        {
            SelectedApp = window.SelectedApp;
        }

        return result;
    }
}
