namespace DashBoard.ViewModel.Dialog;

internal partial class WarningListViewModel : ObservableObject, IDialogAware
{
    public DialogCloseListener RequestClose { get; set; }

    [ObservableProperty]
    private string? _Title;

    [ObservableProperty]
    private ObservableCollection<Alarm_VM>? _Alarms;

    public bool CanCloseDialog()
    {
        return true;
    }

    public void OnDialogClosed()
    {
    }

    public void OnDialogOpened(IDialogParameters parameters)
    {
        this.Title = "报警列表";
        if (!parameters.TryGetValue("alarm", out ObservableCollection<Alarm_VM>? alarms) || alarms is null)
        {
            return;
        }
        this.Alarms = alarms;
    }
}
