using System.Windows.Media;

namespace BS.Shared.DataContracts
{
    public partial class UserGroupDC : IFilterableDC
    {
        public ActivationTypeId ActivationType
        {
            get
            {
                return ActivationTypeId.Active;
            }

            set
            {
            }
        }

        public string DetailDescription
        {
            get
            {
                return this.Name;
            }
        }

        public string FilterRelevants
        {
            get
            {
                return string.Join(" ", new[] { this.Name, this.Description });
            }
        }

        public SolidColorBrush FilterableBrush { get { return new SolidColorBrush(Colors.Transparent); } }

        public string IconPath
        {
            get
            {
                return @"..\Ressources\Icons\UserGroupBusinessDisabled.png";
            }
        }

        public string SimpleDescription
        {
            get
            {
                return this.Name;
            }
        }

        public bool SupportsActivationType
        {
            get
            {
                return false;
            }
        }

        public long Version
        {
            get
            {
                return this.UserGroupVersion.Value;
            }

            set
            {
                this.UserGroupVersion = value;
            }
        }

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

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

            return false;
        }

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