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

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Inject;
import javax.inject.Singleton;

/**
 * User: twalcari
 * Date: 6/29/2015
 * Time: 17:12
 */
@Singleton
public class JFedEnvironment {
    private static final Logger LOG = LoggerFactory.getLogger(JFedEnvironment.class);
    private Integer defaultSliceDuration = null;
    private String customConfigurationFile = null;
    private String loginUrl = null;

    @Inject
    public JFedEnvironment() {
    }


    public Integer getDefaultSliceDuration() {
        return defaultSliceDuration;
    }

    public void setDefaultSliceDuration(int defaultSliceDuration) {
        if (defaultSliceDuration >= 2 * 60) {
            this.defaultSliceDuration = defaultSliceDuration;
            LOG.info("Default slice duration was set  to {} minutes", defaultSliceDuration);
        }else{
            LOG.warn("Cannot set the default slice duration to less than two hours! Ignoring");
        }
    }

    public String getCustomConfigurationFile() {
        return customConfigurationFile;
    }

    public void setCustomConfigurationFile(String customConfigurationFile) {
        this.customConfigurationFile = customConfigurationFile;
    }


    public String getLoginUrl() {
        return loginUrl;
    }

    public void setLoginUrl(String loginUrl) {
        this.loginUrl = loginUrl;
    }
}
