using System.Windows.Media;

namespace BS.Shared.DataContracts
{
    public partial class TextbausteinDC : IFilterableDC
    {
        public override bool Equals(object obj)
        {
            if (obj is TextbausteinDC)
            {
                var y = (TextbausteinDC) obj;
                if (TextbausteinOid == null && y.TextbausteinOid == null)
                {
                    return GetHashCode() == y.GetHashCode();
                }

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

            return false;
        }

        public override int GetHashCode()
        {
            return GetType().Name.GetHashCode() ^ TextbausteinOid.GetHashCode();
        }

        public override string ToString()
        {
            return Name;
        }

        public ActivationTypeId ActivationType { get; set; }
        public string DetailDescription { get { return Text; } }
        public string FilterRelevants { get { return Name + Text; } }
        public string IconPath { get; private set; }
        public string SimpleDescription { get { return Name; } }
        public bool SupportsActivationType { get; private set; }

        public long Version
        {
            get { return TextbausteinVersion == null ? 0 : TextbausteinVersion.Value; }
            set { TextbausteinVersion = value; }
        }

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