import features

from oauth.services.github import GithubOAuthService
from oauth.services.google import GoogleOAuthService

class OAuthLoginManager(object):
  """ Helper class which manages all registered OAuth login services. """
  def __init__(self, config):
    self.services = []

    # Register the endpoints for each of the OAuth login services.
    # TODO(jschorr): make this dynamic.
    if config.get('GITHUB_LOGIN_CONFIG') is not None and features.GITHUB_LOGIN:
      github_service = GithubOAuthService(config, 'GITHUB_LOGIN_CONFIG')
      self.services.append(github_service)

    if config.get('GOOGLE_LOGIN_CONFIG') is not None and features.GOOGLE_LOGIN:
      google_service = GoogleOAuthService(config, 'GOOGLE_LOGIN_CONFIG')
      self.services.append(google_service)