class SessionRepository {

    @Timed(name =Urls.SESSION_REPO_TIMED_GROUP)
    public Optional<LevelOfAssurance> getLevelOfAssuranceFromIdp(SessionId sessionId){

        State currentState = getCurrentState(sessionId);

        if(currentState instanceof Cycle0And1MatchRequestSentState){ // initial match request - no response received
            return Optional.of(((Cycle0And1MatchRequestSentState) currentState).getIdpLevelOfAssurance());
        }
        if(currentState instanceof SuccessfulMatchState){ // when no cycle 3 and no user account creation
            return Optional.of(((SuccessfulMatchState) currentState).getLevelOfAssurance());
        }
        if(currentState instanceof AwaitingCycle3DataState){ // when cycle3 on and user account creation on or off
            return Optional.of(((AwaitingCycle3DataState) currentState).getLevelOfAssurance());
        }
        if(currentState instanceof UserAccountCreatedState){ // when no cycle3 and user account creation
            return Optional.of(((UserAccountCreatedState) currentState).getLevelOfAssurance());
        }

        return Optional.empty();
    }

    @Inject public  SessionRepository(
            SessionStore dataStore,
            StateControllerFactory controllerFactory);

}