import os

class Config:
    SECRET_KEY = os.environ['SECRET_KEY']
    UPLOAD_FOLDER = os.environ['UPLOAD_FOLDER']
    MAX_CONTENT_LENGTH = int(os.environ.get('MAX_CONTENT_LENGTH', 16 * 1024 * 1024))  # default 16MB
    ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}

    # MySQL connection parameters from .env
    MYSQL_USER = os.environ['MYSQL_USER']
    MYSQL_PASSWORD = os.environ['MYSQL_PASSWORD']
    MYSQL_HOST = os.environ['MYSQL_HOST']
    MYSQL_PORT = os.environ.get('MYSQL_PORT', 3306)
    MYSQL_DB = os.environ['MYSQL_DATABASE']

    # Build the SQLAlchemy database URI
    SQLALCHEMY_DATABASE_URI = (
        f"mysql+pymysql://{MYSQL_USER}:{MYSQL_PASSWORD}"
        f"@{MYSQL_HOST}:{MYSQL_PORT}/{MYSQL_DB}"
    )

    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # Optional toggles
    ENABLE_DB_SEEDING = os.environ.get('ENABLE_DB_SEEDING', '0') == '1'
    DOCKER_ENV = os.environ.get('FLASK_ENV', 'production')

    NEO4J_URI = os.getenv('NEO4J_URI', 'bolt://neo4j:7687')
    NEO4J_USER = os.getenv('NEO4J_USER', 'neo4j')
    NEO4J_PASSWORD = os.getenv('NEO4J_PASSWORD', 'your_secure_password')
