//using BeWo.Core.Service;

namespace BS.Shared.DataContracts
{
    public partial class ValueListEntryDC
    {
        // private ValueListEntryDC _ParentEntry;

        // public ValueListEntryDC ParentEntry 
        // {
        // get
        // {
        // if (_ParentEntry == null && ParentOid != null)
        // {
        // _ParentEntry = Cache.GetInstance().GetValueListEntry(ParentOid.Value);
        // }
        // return _ParentEntry;
        // }
        // set
        // {
        // _ParentEntry = value;
        // }
        // }

        public override bool Equals(object obj)
        {
            if (obj is ValueListEntryDC)
            {
                var y = (ValueListEntryDC)obj;
                if (this.ValueListEntryOid == null && y.ValueListEntryOid == null)
                {
                    return this.GetHashCode() == y.GetHashCode();
                }

                if (this.ValueListEntryOid != null && y.ValueListEntryOid != null)
                {
                    return this.ValueListEntryOid == y.ValueListEntryOid;
                }
            }

            return false;
        }

        public override int GetHashCode()
        {
            return this.ValueListEntryOid.HasValue ? this.GetType().Name.GetHashCode() ^ this.ValueListEntryOid.GetHashCode() : base.GetHashCode();
        }

        public override string ToString()
        {
            return this.TypeDescription;
        }
    }
}