class SessionService {

    public AuthnRequestFromHubContainerDto getIdpAuthnRequest(SessionId sessionId) {
        getSessionIfItExists(sessionId);
        final AuthnRequestFromHub request = authnRequestHandler.getIdaAuthnRequestFromHub(sessionId);
        final IdaAuthnRequestFromHubDto authnRequestFromHub = new IdaAuthnRequestFromHubDto(
                request.getId(),
                request.getForceAuthentication(),
                request.getSessionExpiryTimestamp(),
                request.getRecipientEntityId(),
                request.getLevelsOfAssurance(),
                request.getUseExactComparisonType(),
                request.getOverriddenSsoUrl());

        boolean countryIdentityProvider = sessionRepository.isSessionInState(sessionId, EidasCountrySelectedState.class);
        final SamlRequestDto samlRequest;
        if (countryIdentityProvider) {
            samlRequest = samlEngineProxy.generateCountryAuthnRequestFromHub(authnRequestFromHub);
            EidasConnectorMetrics.increment(
                    request.getRecipientEntityId(),
                    EidasConnectorMetrics.Direction.request,
                    EidasConnectorMetrics.Status.ok);

        } else {
            samlRequest = samlEngineProxy.generateIdpAuthnRequestFromHub(authnRequestFromHub);
        }

        return new AuthnRequestFromHubContainerDto(samlRequest.getSamlRequest(), samlRequest.getSsoUri(), request.getRegistering());
    }

    @Inject public  SessionService(SamlEngineProxy samlEngineProxy,
                          TransactionsConfigProxy configProxy,
                          AuthnRequestFromTransactionHandler authnRequestHandler,
                          SessionRepository sessionRepository);

}