using DragonISO.Engine.Domain;

namespace DragonISO.App.ViewModels;

public sealed class AlertBannerViewModel : ObservableObject
{
    private EngineAlert? _current;

    public EngineAlert? Current
    {
        get => _current;
        set
        {
            if (SetField(ref _current, value))
            {
                OnPropertyChanged(nameof(IsVisible));
                OnPropertyChanged(nameof(Message));
            }
        }
    }

    public bool IsVisible => _current is not null;
    public string Message => _current?.Message ?? string.Empty;

    public RelayCommand DismissCommand { get; }

    public AlertBannerViewModel()
    {
        DismissCommand = new RelayCommand(() => Current = null);
    }
}
