using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;

namespace Lumi.Companion.App;

internal sealed class DecisionWindow : Window
{
    public DecisionWindow(string title, string message, string confirmLabel)
    {
        Title = title;
        Width = 470;
        SizeToContent = SizeToContent.Height;
        CanResize = false;
        WindowStartupLocation = WindowStartupLocation.CenterOwner;
        var cancel = new Button { Content = "Cancel", Classes = { "secondary" } };
        var confirm = new Button { Content = confirmLabel, Classes = { "primary" } };
        cancel.Click += (_, _) => Close(false);
        confirm.Click += (_, _) => Close(true);
        Content = new StackPanel
        {
            Margin = new Thickness(28), Spacing = 18,
            Children =
            {
                new TextBlock { Text = title, Classes = { "sectionTitle" } },
                new TextBlock { Text = message, Classes = { "muted" }, TextWrapping = Avalonia.Media.TextWrapping.Wrap },
                new StackPanel { Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Right, Spacing = 10, Children = { cancel, confirm } }
            }
        };
    }
}
