import os
from dotenv import load_dotenv
import logging

load_dotenv()
 
class Config:
    SECRET_KEY = os.urandom(24)

    # MYSQL_HOST = 'localhost'
    # MYSQL_USER = 'root'
    # MYSQL_PASSWORD = 'Pakistan&0098'
    # MYSQL_DB = 'ronnie_gpt'

    MYSQL_HOST = 'localhost'
    MYSQL_USER = 'root'
    MYSQL_PASSWORD = ''
    MYSQL_DB = 'chat_system'

    # Hostinger SMTP Configuration
    SMTP_SERVER = 'smtp.hostinger.com'
    SMTP_PORT = 465  # SSL port
    SMTP_USER = 'gpt@mykaptaan.com' 
    SMTP_PASSWORD = 'RonnieTech@786'
    SENDER_EMAIL = "gpt@mykaptaan.com"
    SENDER_NAME = "MyKaptaan"
    
    # Google OAuth Configuration
    GOOGLE_CLIENT_ID = "436364042456-tlt8faksrblga4vkrtca4dksqgpi4inh.apps.googleusercontent.com"
    GOOGLE_CLIENT_SECRET = "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"
    GOOGLE_REDIRECT_URI = "https://gpt.ronniemarket.com/auth/google/callback"

    # Groq API Configuration
    GROQ_API_KEY = "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"
    GROQ_API_URL = "https://api.groq.com/openai/v1/chat/completions"

    # url = "https://agent.ronniemarket.com"
    url = "http://127.0.0.1:5001/"

    # For local development with ngrok
    # BASE_URL = "https://agent.ronniemarket.com"
    BASE_URL = "https://0bd804b4804c.ngrok-free.app"
    REDIS_URL = "redis://localhost:6379"

    STRIPE_SECRET_KEY = os.getenv("STRIPE_SECRET_KEY", "sk_test_51SN9J9BmV6fSAGOJvlFSPVSv4Z7szh5DZemGtmb45YV89s9FXU11vM5nqYnHtOtBQnk8RT4MFNyVbgFnY6sGCT5g00Qr940uST")
    STRIPE_PUBLISHABLE_KEY = os.getenv("STRIPE_PUBLISHABLE_KEY", "pk_test_51SN9J9BmV6fSAGOJwl6YfBAjOLAbYxg4cWKFfLZeDNjevnR4CM0RZ4ahYZjAOCnPqgovimil4hE8GKTE3hiAk2dP00wUcrExI2")
    STRIPE_SUCCESS_URL = os.getenv("STRIPE_SUCCESS_URL", "")
    STRIPE_CANCEL_URL = os.getenv("STRIPE_CANCEL_URL", "")
    STRIPE_CURRENCY = os.getenv("STRIPE_CURRENCY", "GBP")

def setup_logging():
    # Set up logging configuration
    logging.basicConfig(
        level=logging.INFO,
        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
    )
    
    # Reduce MySQL connector logging
    logging.getLogger('mysql.connector').setLevel(logging.WARNING)
    
    # Reduce urllib3 logging
    logging.getLogger('urllib3').setLevel(logging.WARNING)
    
    # Reduce sentence_transformers logging
    logging.getLogger('sentence_transformers').setLevel(logging.INFO)