import os

# Constants for PyMongo
MONGODB_URL = os.getenv("MONGODB_URL", "mongodb://localhost:27017/") 
MONGODB_USERNAME = os.getenv("MONGODB_USERNAME", "mongoadmin")
MONGODB_PASSWORD = os.getenv("MONGODB_PASSWORD", "secret")
MONGODB_DATABASE = os.getenv("MONGODB_DATABASE", "memorymap")

# Constants for JWT
SECRET_KEY = os.getenv("JWT_SECRET_KEY", "_2YfT44$xF.Tg_xI63UH3D7:N+>pZN2';j%>7H@?e0:Xor'pV[") # only for local development of course :)
ALGORITHM = os.getenv("JWT_ALGORITHM", "HS256")
ACCESS_TOKEN_EXPIRE_MINUTES = int(os.getenv("JWT_ACCESS_TOKEN_EXPIRE_MINUTES", 30))
REFRESH_TOKEN_EXPIRE_MINUTES = int(os.getenv("JWT_REFRESH_TOKEN_EXPIRE_MINUTES", 60 * 24 * 30)) # 30 days

# Constants for OAuth2
TOKEN_URL = "/api/v1/login" # Path to the auth

# Constants for config
UPLOAD_DIR = os.getenv("UPLOAD_DIR", os.path.join(os.path.dirname(os.path.dirname(__file__)), "images"))

# Configuration par défaut du système
DEFAULT_CONFIG = {
    "max_image_size": 8 * 1024 * 1024,  # 8MB
    "max_images_per_pin": 10,
    "max_images_per_user": 100,
    "allowed_image_types": [
        "image/jpeg",
        "image/png",
        "image/gif",
        "image/webp"
    ],
    "max_pins_per_user": 50,
    "max_friends_per_user": 100
}

# Configuration actuelle (sera mise à jour au démarrage)
MAX_IMAGE_SIZE = DEFAULT_CONFIG["max_image_size"]
MAX_IMAGES_PER_PIN = DEFAULT_CONFIG["max_images_per_pin"]
MAX_IMAGES_PER_USER = DEFAULT_CONFIG["max_images_per_user"]
ALLOWED_MIME_TYPES = DEFAULT_CONFIG["allowed_image_types"]
MAX_PINS_PER_USER = DEFAULT_CONFIG["max_pins_per_user"]
MAX_FRIENDS_PER_USER = DEFAULT_CONFIG["max_friends_per_user"]

# Token privé pour les notifications Push
VAPID_PRIVATE_KEY = os.getenv("VAPID_PRIVATE_KEY")

# Claims VAPID pour les notifications Push
VAPID_CLAIMS = {
    "sub": "mailto:admin@memorymap.fr"
}