package be.iminds.ilabt.jfed.experimenter_gui.login;

import be.iminds.ilabt.jfed.lowlevel.user.UserLoginInfo;
import be.iminds.ilabt.jfed.lowlevel.user.UserLoginInfoFactory;
import be.iminds.ilabt.jfed.lowlevel.user.UserLoginInfoManager;
import be.iminds.ilabt.jfed.ui.javafx.userlogin.AdvancedUserLoginDialog;

import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;

/**
 * User: twalcari
 * Date: 8/8/2016
 * Time: 18:05
 */
@Singleton
public class UserLoginDirectorFactory {
    private final UserLoginInfoFactory userLoginInfoFactory;
    private final UserLoginInfoManager userLoginInfoManager;
    private final Provider<URLLoginDialog> urlLoginDialogProvider;
    private final Provider<SimpleUserLoginDialog> simpleUserLoginDialogProvider;
    private final Provider<AdvancedUserLoginDialog> advancedUserLoginDialogProvider;

    @Inject
    public UserLoginDirectorFactory(UserLoginInfoFactory userLoginInfoFactory, UserLoginInfoManager userLoginInfoManager,
                                    Provider<URLLoginDialog> urlLoginDialogProvider,
                                    Provider<SimpleUserLoginDialog> simpleUserLoginDialogProvider,
                                    Provider<AdvancedUserLoginDialog> advancedUserLoginDialogProvider) {
        this.userLoginInfoFactory = userLoginInfoFactory;
        this.userLoginInfoManager = userLoginInfoManager;
        this.urlLoginDialogProvider = urlLoginDialogProvider;
        this.simpleUserLoginDialogProvider = simpleUserLoginDialogProvider;
        this.advancedUserLoginDialogProvider = advancedUserLoginDialogProvider;
    }


    public UserLoginDirector createUserLoginDirector(@Nullable String loginUrl, @Nullable UserLoginInfo userLoginInfo) {
        return new UserLoginDirector(loginUrl, userLoginInfo, userLoginInfoFactory,
                userLoginInfoManager, urlLoginDialogProvider, simpleUserLoginDialogProvider, advancedUserLoginDialogProvider);
    }
}
