using System;
using System.Collections.Generic;

using BS.Shared;

namespace BeWo.Data.Entities
{
    public class Person : BeWoEntityBase
    {
        public static string PropertyName_Abbreviation = "Abbreviation";

        public static string PropertyName_Address = "Address";

        public static string PropertyName_BankAccount = "BankAccount";

        public static string PropertyName_Contacts = "Contacts";

        public static string PropertyName_DateOfBirth = "DateOfBirth";

        public static string PropertyName_FamilyStatus = "FamilyStatus";

        public static string PropertyName_FirstName = "FirstName";

        public static string PropertyName_Function = "Function";

        public static string PropertyName_InvoiceAddress = "InvoiceAddress";

        public static string PropertyName_LastName = "LastName";

        public static string PropertyName_Organisation2Persons = "Organisation2Persons";

        public static string PropertyName_Profession = "Profession";

        public static string PropertyName_Sex = "Sex";

        public static string PropertyName_Title = "Title";

        public static string PropertyName_Type = "Type";

        public static string PropertyName_VarFieldValueList = "VarFieldValueList";

		public static string PropertyName_FirstNameLastName = "FirstNameLastName";

        private string _Abbreviation;

        private Address _Address;

        private BankAccount _BankAccount;

        private IList<Contact> _Contacts;

        private DateTime? _DateOfBirth;

        private FamilyStatus? _FamilyStatus;

        private string _FirstName;

        private ValueListEntry _Function;

        private Address _InvoiceAddress;

        private string _LastName;

        private IList<Organisation2Person> _Organisation2Persons;

        private string _Profession;

        private Sex? _Sex;

        private ValueListEntry _Title;

        private PersonType _Type;

        private IList<VarFieldValue> _VarFieldValueList;

        public Person()
        {
            this._Tid = TableID.Person;
            this._Type = PersonType.Others;
        }

        public virtual string Abbreviation
        {
            get
            {
                return this._Abbreviation;
            }

            set
            {
                if (this.AreDifferent(this._Abbreviation, value))
                {
                    this._Abbreviation = value;
                }
            }
        }

        public virtual Address Address
        {
            get
            {
                return this._Address;
            }

            set
            {
                if (this.AreDifferent(this._Address, value))
                {
                    this._Address = value;
                }
            }
        }

        public virtual BankAccount BankAccount
        {
            get
            {
                return this._BankAccount;
            }

            set
            {
                if (this.AreDifferent(this._BankAccount, value))
                {
                    this._BankAccount = value;
                }
            }
        }

        public virtual IList<Contact> Contacts
        {
            get
            {
                return this._Contacts ?? (this._Contacts = new List<Contact>());
            }

            set
            {
                if (this.AreDifferent(this._Contacts, value))
                {
                    this._Contacts = value;
                }
            }
        }

        public virtual DateTime? DateOfBirth
        {
            get
            {
                return this._DateOfBirth;
            }

            set
            {
                if (this.AreDifferent(this._DateOfBirth, value))
                {
                    this._DateOfBirth = value;
                }
            }
        }

        public virtual FamilyStatus? FamilyStatus
        {
            get
            {
                return this._FamilyStatus;
            }

            set
            {
                if (this.AreDifferent(this._FamilyStatus, value))
                {
                    this._FamilyStatus = value;
                }
            }
        }

        public virtual string FirstName
        {
            get
            {
                return this._FirstName;
            }

            set
            {
                if (this.AreDifferent(this._FirstName, value))
                {
                    this._FirstName = value;
                }
            }
        }

        public virtual string FirstNameLastName
        {
            get
            {
                return this.FirstName + " " + this.LastName;
            }
        }

        public virtual ValueListEntry Function
        {
            get
            {
                return this._Function;
            }

            set
            {
                if (this.AreDifferent(this._Function, value))
                {
                    this._Function = value;
                }
            }
        }

        public virtual Address InvoiceAddress
        {
            get
            {
                return this._InvoiceAddress;
            }

            set
            {
                if (this.AreDifferent(this._InvoiceAddress, value))
                {
                    this._InvoiceAddress = value;
                }
            }
        }

        public virtual string LastName
        {
            get
            {
                return this._LastName;
            }

            set
            {
                if (this.AreDifferent(this._LastName, value))
                {
                    this._LastName = value;
                }
            }
        }

        public virtual IList<Organisation2Person> Organisation2Persons
        {
            get
            {
                return this._Organisation2Persons ?? (this._Organisation2Persons = new List<Organisation2Person>());
            }

            set
            {
                if (this.AreDifferent(this._Organisation2Persons, value))
                {
                    this._Organisation2Persons = value;
                }
            }
        }

        public virtual string Profession
        {
            get
            {
                return this._Profession;
            }

            set
            {
                if (this.AreDifferent(this._Profession, value))
                {
                    this._Profession = value;
                }
            }
        }

        public virtual Sex? Sex
        {
            get
            {
                return this._Sex;
            }

            set
            {
                if (this.AreDifferent(this._Sex, value))
                {
                    this._Sex = value;
                }
            }
        }

        public virtual ValueListEntry Title
        {
            get
            {
                return this._Title;
            }

            set
            {
                if (this.AreDifferent(this._Title, value))
                {
                    this._Title = value;
                }
            }
        }

        public virtual PersonType Type
        {
            get
            {
                return this._Type;
            }

            set
            {
                if (this.AreDifferent(this._Type, value))
                {
                    this._Type = value;
                }
            }
        }

        public virtual IList<VarFieldValue> VarFieldValueList
        {
            get
            {
                return this._VarFieldValueList ?? (this._VarFieldValueList = new List<VarFieldValue>());
            }

            set
            {
                if (this.AreDifferent(this._VarFieldValueList, value))
                {
                    this._VarFieldValueList = value;
                }
            }
        }

        public override string ToString()
        {
            return this.FirstName + " " + this.LastName;
        }
    }
}