using System.Collections.ObjectModel;
using System.ComponentModel;

namespace Silverlight_Binding_TreeView
{
	public class Organization : INotifyPropertyChanged
	{
		private string name;
		private bool selected;
		private bool expanded;
		private bool check;

		public Organization(string name, bool selected, bool expanded, bool check)
		{
			this.name = name;
			this.selected = selected;
			this.expanded = expanded;
			this.check = check;
			this.Departments = new ObservableCollection<Department>();
		}

		public string Name
		{
			get
			{
				return this.name;
			}
			set
			{
				if (this.name != value)
				{
					this.name = value;
					this.NotifyPropertyChanged("Name");
				}
			}
		}
		public bool Selected
		{
			get
			{
				return selected;
			}
			set
			{
				if (this.selected != value)
				{
					this.selected = value;
					this.NotifyPropertyChanged("Selected");
				}
			}
		}
		public bool Expanded
		{
			get
			{
				return this.expanded;
			}
			set
			{
				if (this.expanded != value)
				{
					this.expanded = value;
					this.NotifyPropertyChanged("Expanded");
				}
			}
		}
		public bool Checked
		{
			get
			{
				return this.check;
			}
			set
			{
				if (this.check != value)
				{
					this.check = value;
					this.NotifyPropertyChanged("Checked");
				}
			}
		}
		public ObservableCollection<Department> Departments
		{
			get;
			set;
		}

		#region INotifyPropertyChanged Members

		public event PropertyChangedEventHandler PropertyChanged;
		private void NotifyPropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}

		#endregion
	}
}
