import os
from httpx_oauth.clients.google import GoogleOAuth2
from dotenv import load_dotenv

# Load environment variables from .env file
load_dotenv()

# --- Environment Variables ---
# These are loaded from your .env file
GOOGLE_CLIENT_ID = os.environ.get("GOOGLE_CLIENT_ID")
GOOGLE_CLIENT_SECRET = os.environ.get("GOOGLE_CLIENT_SECRET")
OAUTH_STATE_SECRET = os.environ.get("SECRET_KEY") # Use the main secret key for state

# --- OAuth2 Client Definitions ---
# You can add more clients here (e.g., GitHub, Facebook)
google_oauth_client = None
if GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET:
    google_oauth_client = GoogleOAuth2(
        client_id=GOOGLE_CLIENT_ID,
        client_secret=GOOGLE_CLIENT_SECRET,
        # The "openid" scope is required for the user's ID.
        # "email" and "profile" are common scopes to get user information.
        scope=["openid", "email", "profile"],
        name="google", # A unique name for this provider
    )