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

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

      public Dictionary<Images, string> ImageToResourcePathDict 
      { 
         get
         {
            return _imageToResourcePathDict;
         }

         private set { } 
      }

      private Dictionary<Images, string> _imageToResourcePathDict = new Dictionary<Images, string>()
      {
         {Images.PASS_CHECK, @"pack://application:,,,/Program;component/Resources/Images/green-check-mark.png" },
         {Images.FAIL_CHECK, @"pack://application:,,,/Program;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();
         });
      }
   }
}
