"""
Django Test App Configuration for Storm Logger 2.0
App configuration for Django integration testing
"""

from django.apps import AppConfig


class TestAppConfig(AppConfig):
    """Configuration for the test app."""
    
    default_auto_field = "django.db.models.BigAutoField"
    name = "tests.django_hooks.test_app"
    verbose_name = "Storm Logger Test App"
    
    def ready(self):
        """Initialize the app with Storm Logger."""
        try:
            from pathlib import Path

            from storm_logger import StormLogger, StormLoggerConfig

            # Use test-safe configuration
            test_config = StormLoggerConfig(
                log_directory=Path(__file__).parent.parent.parent.parent / "logs" / "tests",
                enable_console=False,  # Disable console during test collection
                debug_mode=True
            )
            
            logger = StormLogger(__name__, config=test_config)
            logger.info("Django test app initialized for Storm Logger testing")
            # Only call business_metric if it exists
            if hasattr(logger, 'business_metric'):
                logger.business_metric("app_initializations", 1)
        except Exception:
            # Fallback to standard logging if Storm Logger fails
            import logging
            logging.getLogger(__name__).info("Django test app initialized (fallback logging)")