using System;
using System.Collections.Generic;
using System.Text;
using EnterpriseDesktop.Common.Validation;

namespace EnterpriseDesktop.Contacts.BusinessLayer
{
    public class Contact : BusinessEntity
    {
        public Contact()
            : base()
        {
        }

        private string _firstName;
        public string FirstName
        {
            get { return _firstName; }
            set { _firstName = value; }
        }

        private string _lastName;

        public string LastName
        {
            get { return _lastName; }
            set { _lastName = value; }
        }

        private string _email;

        public string Email
        {
            get { return _email; }
            set { _email = value; }
        }

        private bool _nameStyle;

        public bool NameStyle
        {
            get { return _nameStyle; }
            set { _nameStyle = value; }
        }

        private int _emailPromotion;

        public int EmailPromotion
        {
            get { return _emailPromotion; }
            set { _emailPromotion = value; }
        }

        private string _passwdHash;

        public string PasswordHash
        {
            get { return _passwdHash; }
            set { _passwdHash = value; }
        }

        private string _passwdSalt;

        public string PasswordSalt
        {
            get { return _passwdSalt; }
            set { _passwdSalt = value; }
        }

        private Guid rowGuid;

        public Guid RowGuid
        {
            get { return rowGuid; }
            set { rowGuid = value; }
        }
	

        public void AddValidationRules()
        {
            Rule rule = new Rule("FirstName", "First Name is required.", CommonRules.StringRequired);
            this.ValidateRules.Add(rule);

            Rule ruleName1 = new Rule("FirstName", "The First Name must be at least 2 characters long and not contain illegal characters.", CommonRules.ValidateName);
            this.ValidateRules.Add(ruleName1);

            Rule ruleName2 = new Rule("LastName", "The Last Name must be at least 2 characters long and not contain illegal characters.", CommonRules.ValidateName);
            this.ValidateRules.Add(ruleName2);

            Rule rule2 = new Rule("LastName", "Last Name is required.", CommonRules.StringRequired);
            this.ValidateRules.Add(rule2);

            Rule emailRule = new Rule("Email", "Email must be in the form of asdf@asdf.com.", CommonRules.ValidateEmailAddress);
            this.ValidateRules.Add(emailRule);
        }
    }
}
