using System;

namespace skyscraper5.Skyscraper.Plugins
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
	public sealed class DescriptorPluginNitHandlerAttribute : Attribute
	{
		public DescriptorPluginNitHandlerAttribute(Type handler)
		{
			object boxed = Activator.CreateInstance(handler);
			DescriptorPluginNitHandler unboxed = (DescriptorPluginNitHandler)boxed;
			if (unboxed == null)
			{
				throw new NotImplementedException(String.Format("{0} is not an {1}", handler.Name, nameof(DescriptorPluginEitHandler)));
			}

			Handler = unboxed;
		}

		public DescriptorPluginNitHandler Handler { get; private set; }
	}
}
