using CommunityToolkit.Mvvm.ComponentModel;
using ProgramGui.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Threading;

namespace ProgramGui.ViewModel
{
   public class ImpedanceCheckWindowViewModel : ObservableObject
   {
      private Window _window;
      public enum Images
      {
         PASS_CHECK,
         FAIL_CHECK
      }

      public Dictionary<Images, string> _imageToResourcePathDict = new Dictionary<Images, string>()
      {
         {Images.PASS_CHECK, @"pack://application:,,,/ProgramGui;component/Resources/Images/green-check-mark.png" },
         {Images.FAIL_CHECK, @"pack://application:,,,/ProgramGui;component/Resources/Images/red-cross-mark.png" }
      };

      #region Data Bindings
      public ObservableCollection<ImpedanceDataModel> _listviewImpedanceDatatems { get; set; }

      #endregion Data Bindings

      public ImpedanceCheckWindowViewModel(Window window)
      {
         _window = window;
         _listviewImpedanceDatatems = new ObservableCollection<ImpedanceDataModel>();
      }

      public void AddData(ImpedanceDataModel item)
      {
         _window.Dispatcher.Invoke((Action)delegate
         {
            _listviewImpedanceDatatems.Add(item);
         });
      }

      public void ClearData()
      {
         _window.Dispatcher.Invoke((Action)delegate
         {
            _listviewImpedanceDatatems.Clear();
         });
      }
   }
}
