package org.musetest.core.events;

import org.musetest.core.*;
import org.musetest.core.resource.generic.*;
import org.musetest.core.resource.types.*;
import org.musetest.core.test.plugin.*;
import org.musetest.core.values.*;

/**
 * @author Christopher L Merrill (see LICENSE.txt for license details)
 */
@MuseTypeId("event-logger-plugin")
@SuppressWarnings("unused") // Instantiated by reflection
public class EventLoggerConfiguration extends GenericResourceConfiguration implements TestPluginConfiguration
	{
	@Override
	public TestPlugin createPlugin()
		{
		return new EventLogger(this);
		}

	@Override
	public ResourceType getType()
		{
		return new EventLoggerType();
		}

	public final static String TYPE_ID = EventLoggerConfiguration.class.getAnnotation(MuseTypeId.class).value();

	@SuppressWarnings("unused") // used by reflection
	public static class EventLoggerType extends ResourceSubtype
		{
		@Override
		public EventLoggerConfiguration create()
			{
			final EventLoggerConfiguration config = new EventLoggerConfiguration();
			config.parameters().addSource(BaseTestPlugin.AUTO_APPLY_PARAM, ValueSourceConfiguration.forValue(true));
			config.parameters().addSource(BaseTestPlugin.APPLY_CONDITION_PARAM, ValueSourceConfiguration.forValue(true));
			return config;
			}

		@SuppressWarnings("WeakerAccess")  // instantiated by reflection
		public EventLoggerType()
			{
			super(TYPE_ID, "Event Logger", EventLoggerConfiguration.class, new TestPluginConfigurationResourceType());
			}
		}
	}

@@ -218,16 +218,62 @@
 alues.*;
+%0Aimport org.musetest.core.values.descriptor.*;
 %0A%0A/**%0A *
@@ -380,16 +380,485 @@
 lugin%22)%0A
+@MuseSubsourceDescriptor(displayName = %22Apply automatically?%22, description = %22If this source resolves to true, this plugin configuration will be automatically applied to tests%22, type = SubsourceDescriptor.Type.Named, name = BaseTestPlugin.AUTO_APPLY_PARAM)%0A@MuseSubsourceDescriptor(displayName = %22Apply only if%22, description = %22Apply only if this source this source resolves to true%22, type = SubsourceDescriptor.Type.Named, name = BaseTestPlugin.APPLY_CONDITION_PARAM)%0A
 @Suppres

Add annotations to EventLoggerConfiguration for the UI