package be.iminds.ilabt.jfed.lowlevel.connection;

import be.iminds.ilabt.jfed.lowlevel.ApiInfo;
import be.iminds.ilabt.jfed.lowlevel.GeniUser;
import be.iminds.ilabt.jfed.lowlevel.JFedException;
import be.iminds.ilabt.jfed.fedmon.webapi.service.json.*;
import be.iminds.ilabt.jfed.util.JFedTrustStore;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.net.URL;
import java.util.List;

/**
 * JFedConnectionProvider
 */
public interface JFedConnectionProvider {
    //GeniUser user is only required for HTTPS connections

    JFedConnection getConnectionByAuthority(@Nullable GeniUser user, @Nonnull Server server, @Nonnull Class targetClass) throws JFedException;
    JFedConnection getConnectionByAuthority(@Nullable GeniUser user, @Nonnull Server server, @Nonnull ApiInfo.Api api) throws JFedException;

    JFedConnection getConnectionByUrl(JFedTrustStore jFedTrustStore, @Nullable GeniUser user, URL url,
                                      HandleUntrustedCallback handleUntrustedCallback, ApiInfo.Api api,
                                      @Nullable Service optionalServiceForDebugInfo, List<String> overrideAllowedServerCertificateAlias) throws JFedException;

}
