package eu.ydp.empiria.player.client;

import static org.mockito.Mockito.mock;

import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.google.inject.assistedinject.FactoryModuleBuilder;

import eu.ydp.empiria.player.client.controller.multiview.PanelCache;
import eu.ydp.empiria.player.client.gin.factory.PageScopeFactory;
import eu.ydp.empiria.player.client.gin.factory.VideoTextTrackElementFactory;
import eu.ydp.empiria.player.client.media.texttrack.VideoTextTrackElementPresenter;
import eu.ydp.empiria.player.client.module.media.MediaControllerFactory;
import eu.ydp.empiria.player.client.module.media.fullscreen.VideoFullScreenHelper;
import eu.ydp.empiria.player.client.module.object.template.ObjectTemplateParser;
import eu.ydp.empiria.player.client.resources.StyleNameConstants;
import eu.ydp.empiria.player.client.util.SchedulerImpl;
import eu.ydp.empiria.player.client.util.events.bus.EventsBus;
import eu.ydp.empiria.player.client.util.events.bus.PlayerEventsBus;
import eu.ydp.empiria.player.client.util.scheduler.Scheduler;
import eu.ydp.empiria.player.client.util.style.NativeStyleHelper;
import eu.ydp.gwtutil.client.ui.GWTPanelFactory;
import eu.ydp.gwtutil.junit.mock.GWTConstantsMock;
import eu.ydp.gwtutil.test.AbstractTestModule;
import eu.ydp.gwtutil.test.mock.GwtPanelFactoryMock;

public class TestGuiceModule extends AbstractTestModule {
	public TestGuiceModule() {
	}

	public TestGuiceModule(Class<?>... classToOmit) {
		super(classToOmit);
	}

	@Override
	public void configure() {
		bind(Scheduler.class).to(SchedulerImpl.class).in(Singleton.class);
		bind(EventsBus.class).to(PlayerEventsBus.class).in(Singleton.class);
		bind(VideoFullScreenHelper.class).in(Singleton.class);
		bind(PanelCache.class);
		install(new FactoryModuleBuilder().build(VideoTextTrackElementFactory.class));
		install(new FactoryModuleBuilder().build(PageScopeFactory.class));
	}

	@Provides
	@Singleton
	public StyleNameConstants getNameConstants() {
		return GWTConstantsMock.mockAllStringMethods(mock(StyleNameConstants.class),StyleNameConstants.class);
	}

	@Provides
	public MediaControllerFactory getMediaControllerFactory() {
		MediaControllerFactory factory = mock(MediaControllerFactory.class);
		return factory;
	}

	@Provides
	@Singleton
	public VideoTextTrackElementPresenter getVideoTextTrackElementPresenter(){
		return mock(VideoTextTrackElementPresenter.class);
	}


	@Provides
	public ObjectTemplateParser getObjectTemplateParser(MediaControllerFactory factory) {
		ObjectTemplateParser<?> parser = new ObjectTemplateParser();
		parser.setFactory(factory);
		return parser;
	}

	@Provides
	public GWTPanelFactory gwtPanelFactory(){
		return new GwtPanelFactoryMock();
	}

	@Provides
	@Singleton
	public NativeStyleHelper getNativeStyleHelper(){
		return mock(NativeStyleHelper.class);
	}

}

@@ -1081,75 +1081,8 @@
 r;%0D%0A
-import eu.ydp.empiria.player.client.util.style.NativeStyleHelper;%0D%0A
 impo
@@ -2714,32 +2714,34 @@
 yMock();%0D%0A%09%7D%0D%0A%0D%0A
+//
 %09@Provides%0D%0A%09@Si
@@ -2728,32 +2728,34 @@
 %0D%0A//%09@Provides%0D%0A
+//
 %09@Singleton%0D%0A%09pu
@@ -2743,32 +2743,34 @@
 %0A//%09@Singleton%0D%0A
+//
 %09public NativeSt
@@ -2800,24 +2800,26 @@
 eHelper()%7B%0D%0A
+//
 %09%09return moc
@@ -2843,21 +2843,23 @@
 er.class);%0D%0A
+//
 %09%7D%0D%0A%0D%0A%7D%0D%0A

repair mock creating bug 72518