using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Windows.Input;

namespace VistaAdmin.Configuration.Models
{
    public class Environment : INotifyPropertyChanged
    {
        //#region DependencyProperties
        //public static readonly DependencyProperty ServernameProperty =
        //    DependencyProperty.Register("Servername", typeof(String), typeof(Environment));
        //public static readonly DependencyProperty NameProperty =
        //    DependencyProperty.Register("Name", typeof(String), typeof(Environment));
        //public static readonly DependencyProperty DatabasenameProperty =
        //    DependencyProperty.Register("Databasename", typeof(String), typeof(Environment));
        //public static readonly DependencyProperty UsernameProperty =
        //    DependencyProperty.Register("Username", typeof(String), typeof(Environment));
        //public static readonly DependencyProperty PasswordProperty =
        //    DependencyProperty.Register("Password", typeof(String), typeof(Environment));
        //public static readonly DependencyProperty ServerTypeProperty =
        //    DependencyProperty.Register("ServerType", typeof(String), typeof(Environment));
        //public static readonly DependencyProperty RootPathProperty =
        //    DependencyProperty.Register("RootPath", typeof(String), typeof(Environment));
        //#endregion

        private string serverName;
        private string name;
        private string databaseName;
        private string username;
        private string password;
        private string serverType;
        private string rootPath;

        #region IEnvironment Members

        [XmlAttribute(AttributeName = "Servername")]
        public string Servername
        {
            get { return serverName; }
            set
            {
                serverName = value;
                OnPropertyChanged("Servername");
            }
        }

        [XmlAttribute(AttributeName = "Name")]
        public string Name
        {
            get { return name; }
            set
            {
                name = value;
                OnPropertyChanged("Name");
            }
        }

        [XmlAttribute(AttributeName = "Databasename")]
        public string Databasename
        {
            get { return databaseName; }
            set
            {
                databaseName = value;
                OnPropertyChanged("Databasename");
            }
        }

        [XmlAttribute(AttributeName = "Username")]
        public string Username
        {
            get { return username; }
            set
            {
                username = value;
                OnPropertyChanged("Username");
            }
        }

        [XmlAttribute(AttributeName = "Password")]
        public string Password
        {
            get { return password; }
            set
            {
                this.password = value;
                OnPropertyChanged("Password");
            }
        }

        [XmlAttribute(AttributeName = "ServerType")]
        public string ServerType
        {
            get { return serverType; }
            set
            {
                serverType = value;
                OnPropertyChanged("ServerType");
            }
        }

        [XmlAttribute(AttributeName = "RootPath")]
        public string RootPath
        {
            get { return rootPath; }
            set
            {
                rootPath = value;
                OnPropertyChanged("RootPath");
            }

        }
        #endregion

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
