using System;
using System.ComponentModel;

namespace FirstUniversalApp.ViewModels
{
	public class ItemViewModel : INotifyPropertyChanged
	{
		private string _id;
		public string Id
		{
			get
			{
				return _id;
			}
			set
			{
				if (value != _id)
				{
					_id = value;
					NotifyPropertyChanged("ID");
				}
			}
		}

		private string _title;
		public string Title
		{
			get
			{
				return _title;
			}
			set
			{
				if (value != _title)
				{
					_title = value;
					NotifyPropertyChanged("LineOne");
				}
			}
		}

		private string _author;
		public string Author
		{
			get
			{
				return _author;
			}
			set
			{
				if (value != _author)
				{
					_author = value;
					NotifyPropertyChanged("LineTwo");
				}
			}
		}

		private Uri _uri;
		public Uri ImageUri
		{
			get
			{
				return _uri;
			}
			set
			{
				if (value != _uri)
				{
					_uri = value;
					NotifyPropertyChanged("ImageUri");
				}
			}
		}

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