using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;

namespace RadGridView_WPF_AR_5
{
	/// <summary>
	/// A football club.
	/// </summary>
	public class Club : INotifyPropertyChanged
	{
		public event PropertyChangedEventHandler PropertyChanged;

		private string name;
		private DateTime established;
		private int stadiumCapacity;

		public string Name
		{
			get { return this.name; }
			set
			{
				if (value != this.name)
				{
					this.name = value;
					this.OnPropertyChanged("Name");
				}
			}
		}

		public DateTime Established
		{
			get { return this.established; }
			set
			{
				if (value != this.established)
				{
					this.established = value;
					this.OnPropertyChanged("Established");
				}
			}
		}

		public int StadiumCapacity
		{
			get { return this.stadiumCapacity; }
			set
			{
				if (value != this.stadiumCapacity)
				{
					this.stadiumCapacity = value;
					this.OnPropertyChanged("StadiumCapacity");
				}
			}
		}

		private bool isChampion;
		public bool IsChampion
		{
			get
			{
				return this.isChampion;
			}
			set
			{
				if (this.isChampion != value)
				{
					this.isChampion = value;
					this.OnPropertyChanged("IsChampion");
				}
			}
		}
		private bool isChampion1;
		public bool IsChampion1
		{
			get
			{
				return this.isChampion1;
			}
			set
			{
				if (this.isChampion1 != value)
				{
					this.isChampion1 = value;
					this.OnPropertyChanged("IsChampion1");
				}
			}
		}

		private bool isChampion2;
		public bool IsChampion2
		{
			get
			{
				return this.isChampion2;
			}
			set
			{
				if (this.isChampion2 != value)
				{
					this.isChampion2 = value;
					this.OnPropertyChanged("IsChampion2");
				}
			}
		}
		

		public Club()
		{

		}

		public Club(string name, DateTime established, int stadiumCapacity, bool isChampion, bool isChampion1, bool isChampion2)
		{
			this.name = name;
			this.established = established;
			this.stadiumCapacity = stadiumCapacity;
			this.isChampion = isChampion;
			this.isChampion1 = isChampion1;
			this.isChampion2 = isChampion2;

		}

		protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)
		{
			PropertyChangedEventHandler handler = this.PropertyChanged;
			if (handler != null)
			{
				handler(this, args);
			}
		}

		private void OnPropertyChanged(string propertyName)
		{
			this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
		}

		public override string ToString()
		{
			return this.Name;
		}

		public static ObservableCollection<Club> GetClubs()
		{
			ObservableCollection<Club> clubs = new ObservableCollection<Club>();
			Club club;

			// Liverpool
			club = new Club("Liverpool", new DateTime(1892, 1, 1), 45362, true, false, false);
			clubs.Add(club);

			// Manchester Utd.
			club = new Club("Manchester Utd.", new DateTime(1878, 1, 1), 76212, false, true, true);
			clubs.Add(club);

			// Chelsea
			club = new Club("Chelsea", new DateTime(1905, 1, 1), 42055, true, false, false);
			clubs.Add(club);

			// Arsenal
			club = new Club("Arsenal", new DateTime(1886, 1, 1), 60355, true, false, false);
			clubs.Add(club);

			return clubs;
		}
	}
}
