using System.Windows.Media;

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

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

            return false;
        }

        public SolidColorBrush GetBrush()
        {
            return new SolidColorBrush((Color) ColorConverter.ConvertFromString(Color));
        }

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

        public override string ToString()
        {
            return Name;
        }

		public ActivationTypeId ActivationType { get; set; }

		public string DetailDescription
		{
			get
			{
				return Name;
			}
		}

		public string FilterRelevants
		{
			get
			{
				return Name;
			}
		}

		public string IconPath { get; private set; }
		public string SimpleDescription
		{
			get
			{
				return Name;
			}
		}

		public bool SupportsActivationType
		{
			get
			{
				return true;
			}
		}

		public long Version
		{
			get { return ResourceVersion.Value; }
			set { ResourceVersion = value; }
		}

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