using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace skyscraper5.UI.StreamAcquisition
{
	internal class StreamAcquirerListItem : ListViewItem
	{
		public StreamAcquirerListItem(IStreamAcquirer wrapped)
		{
			Wrapped = wrapped;
			WrappedAttribute = (StreamAcquirerAttribute)Wrapped.GetType().GetCustomAttribute(typeof(StreamAcquirerAttribute));

			Text = GetName();
			SubItems.Add(GetDescription());
		}

		public IStreamAcquirer Wrapped { get; }
		public StreamAcquirerAttribute WrappedAttribute { get; }

		public bool Hidden
		{
			get
			{
				if (WrappedAttribute == null)
					return true;

				return WrappedAttribute.Hidden;
			}
		}

		public string GetName()
		{
			if (WrappedAttribute == null)
				return Wrapped.GetType().Name;

			return WrappedAttribute.Name;
		}

		public string GetDescription()
		{
			if (WrappedAttribute == null)
				return "???";

			return WrappedAttribute.Description;
		}

	}
}
