package be.iminds.ilabt.jfed.ui.javafx.userlogin;/**
 * User: twalcari
 * Date: 11/28/2014
 * Time: 16:51
 */

import be.iminds.ilabt.jfed.BaseGuiModule;
import be.iminds.ilabt.jfed.highlevel.HighLevelModule;
import be.iminds.ilabt.jfed.highlevel.LowLevelModule;
import be.iminds.ilabt.jfed.highlevel.SfaOnlyExperimentModule;
import be.iminds.ilabt.jfed.highlevel.UserLoginModelModule;
import be.iminds.ilabt.jfed.ui.javafx.GuiceFXMLUtil;
import be.iminds.ilabt.jfed.util.GuiceContext;
import com.google.inject.Module;
import javafx.application.Application;
import javafx.stage.Stage;

import javax.inject.Inject;
import javax.inject.Provider;
import java.util.ArrayList;
import java.util.List;

public class UserLoginControllerTest extends Application {

   @Inject
    private Provider<AdvancedUserLoginDialog> advancedUserLoginDialogProvider;

    private final GuiceContext context = new GuiceContext(this, () -> {
        List<Module> modules = new ArrayList<>();
        modules.add(new HighLevelModule());
        modules.add(new SfaOnlyExperimentModule());
        modules.add(new LowLevelModule());
        modules.add(new UserLoginModelModule(true));
        modules.add(new BaseGuiModule());
        modules.add(binder -> binder.requestStaticInjection(GuiceFXMLUtil.class));
        return modules;
    });

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        context.init();
        advancedUserLoginDialogProvider.get().showUserLogin(null);

    }
}
