using System.Collections.Generic;

using BS.Shared;

namespace BeWo.Data.Entities
{
    public class Employee2Customer : BeWoEntityBase
    {
        public static string PropertyName_Customer = "Customer";

        public static string PropertyName_CustomerOid = "CustomerOid";

        public static string PropertyName_Employee = "Employee";

        public static string PropertyName_EmployeeOid = "EmployeeOid";

        public static string PropertyName_ValueList = "ValueList";

        private Customer _Customer;

        private long? _CustomerOid;

        private Employee _Employee;

        private long? _EmployeeOid;

        private IList<ValueListEntry2Object> _ValueList;

        public Employee2Customer()
        {
            this._Tid = TableID.Employee2Customer;
        }

        public virtual Customer Customer
        {
            get
            {
                return this._Customer;
            }

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

                    if (this._Customer != null)
                    {
                        this.CustomerOid = this._Customer.Oid;
                    }
                    else
                    {
                        this.CustomerOid = null;
                    }
                }
            }
        }

        public virtual long? CustomerOid
        {
            get
            {
                return this._CustomerOid;
            }

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

        public virtual Employee Employee
        {
            get
            {
                return this._Employee;
            }

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

                    if (this._Employee != null)
                    {
                        this.EmployeeOid = this._Employee.Oid;
                    }
                    else
                    {
                        this.EmployeeOid = null;
                    }
                }
            }
        }

        public virtual long? EmployeeOid
        {
            get
            {
                return this._EmployeeOid;
            }

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

        public virtual IList<ValueListEntry2Object> ValueList
        {
            get
            {
                return this._ValueList ?? (this._ValueList = new List<ValueListEntry2Object>());
            }

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