"""
Configuration settings for INDEX-SISTEM-JOCURI v2.0
"""

import os
from pathlib import Path

class Config:
    """Base configuration"""
    SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-secret-key-change-in-production'
    DATABASE_URL = os.environ.get('DATABASE_URL') or 'sqlite:///data/activities.db'
    
    # Application settings
    FLASK_ENV = os.environ.get('FLASK_ENV') or 'development'
    DEBUG = os.environ.get('DEBUG', 'false').lower() == 'true'
    
    # Data directories
    BASE_DIR = Path(__file__).parent.parent
    DATA_DIR = BASE_DIR / 'data'
    INDEX_MASTER_FILE = DATA_DIR / 'INDEX_MASTER_JOCURI_ACTIVITATI.md'
    
    # Search settings
    SEARCH_RESULTS_LIMIT = int(os.environ.get('SEARCH_RESULTS_LIMIT', '100'))
    FTS_ENABLED = True
    
    @staticmethod
    def ensure_directories():
        """Ensure required directories exist"""
        Config.DATA_DIR.mkdir(exist_ok=True)

class ProductionConfig(Config):
    """Production configuration"""
    DEBUG = False
    SECRET_KEY = os.environ.get('SECRET_KEY') or 'default-production-key-change-me'

class DevelopmentConfig(Config):
    """Development configuration"""
    DEBUG = True

class TestingConfig(Config):
    """Testing configuration"""
    TESTING = True
    DATABASE_URL = 'sqlite:///:memory:'