using parkMonitor.model;
using parkMonitor.view;
using parkMonitor.viewModel.detail;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace parkMonitor.viewModel.objectTree {
	/// <summary>部件树小类ViewModel</summary>
	public class ObjectItemVM : INotifyPropertyChanged, ISelectProperty {
		//name
		string _Name = "";
		public string Name {
			get { return _Name; }
			set { _Name = value; FirePropertyChanged("Name"); }
		}

		//Short Name
		string _ShortName = "";
		public string ShortName {
			get { return _ShortName; }
			set { _ShortName = value; FirePropertyChanged("ShortName"); }
		}

		//主键
		object _Pkey = null;
		public object Pkey {
			get { return _Pkey; }
			set { _Pkey = value; FirePropertyChanged("Pkey"); }
		}

		//设备类型
		DeviceType _DevType = DeviceType.Unknown;
		public DeviceType DevType {
			get { return _DevType; }
			set { _DevType = value; FirePropertyChanged("DevType"); }
		}

		//ui显示类型
		DevTreeItemShowType _UiType = DevTreeItemShowType.Default;
		public DevTreeItemShowType UiType {
			get { return _UiType; }
			set { _UiType = value; FirePropertyChanged("UiType"); }
		}

		//图片设备类型
		DeviceType _ImgType = DeviceType.Unknown;
		public DeviceType ImgType {
			get { return _ImgType; }
			set { _ImgType = value; FirePropertyChanged("ImgType"); }
		}

		//信息
		string _ShortInfo = "";
		public string ShortInfo {
			get { return _ShortInfo; }
			set { _ShortInfo = value; FirePropertyChanged("ShortInfo"); }
		}

		//鼠标悬停显示信息
		string _OverInfo = "";
		public string OverInfo {
			get { return _OverInfo; }
			set { _OverInfo = value; FirePropertyChanged("OverInfo"); }
		}

		//状态
		ComInfoStatus _ObjStatus = ComInfoStatus.None;
		public ComInfoStatus ObjStatus {
			get { return _ObjStatus; }
			set { _ObjStatus = value; FirePropertyChanged("ObjStatus"); }
		}

		//Alarm Status
		AlarmStatus _AlarmStatus = AlarmStatus.None;
		public AlarmStatus AlarmStatus {
			get { return _AlarmStatus; }
			set { _AlarmStatus = value; FirePropertyChanged("AlarmStatus"); }
		}

		//信息项
		ObservableCollection<DevDetailItemVM> _LstItem = new ObservableCollection<DevDetailItemVM>();
		public ObservableCollection<DevDetailItemVM> LstItem {
			get { return _LstItem; }
			set { _LstItem = value; FirePropertyChanged("LstItem"); }
		}

		//是否可复位
		bool _CanReset = false;
		public bool CanReset {
			get { return _CanReset; }
			set { _CanReset = value; FirePropertyChanged("CanReset"); }
		}

		//是否选中
		bool _IsSelected = false;
		public bool IsSelected {
			get { return _IsSelected; }
			set { _IsSelected = value; FirePropertyChanged("IsSelected"); }
		}

		public virtual event PropertyChangedEventHandler PropertyChanged;
		public virtual void FirePropertyChanged(string propertyName) {
			if(PropertyChanged != null) {
				PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}

}
