﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Builder.UIEA
{
    public abstract class TreeNode : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        bool vIsSelected;
        bool vIsExpanded;

        public bool IsSelected
        {
            get
            {
                return vIsSelected;
            }
            set
            {
                vIsSelected = value;
                OnPropertyChanged("IsSelected");
            }
        }
        public bool IsExpanded
        {
            get
            {
                return vIsExpanded;
            }
            set
            {
                vIsExpanded = value;
                OnPropertyChanged("IsExpanded");
            }
        }
        public abstract string Title
        {
            get;
        }
        public abstract bool IsChanged
        {
            get;
        }
        public virtual string StatusCaption
        {
            get
            {
                return Title;
            }
        }

        public abstract void Save();

        public void OnPropertyChanged(string propName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
            }
        }
    }
}
