"""
Consolidated ViewSets for ThrillWiki API v1.

This module contains ViewSets that are shared across domains or don't fit
into specific domain modules. Domain-specific ViewSets have been moved to:
- Parks: api/v1/parks/views.py
- Rides: api/v1/rides/views.py
- Accounts: api/v1/accounts/views.py
- History: api/v1/history/views.py
- Auth/Health/Trending: api/v1/views/
"""

# This file is intentionally minimal now that ViewSets have been distributed
# to domain-specific modules. Only shared utilities and fallback classes remain.


# Handle optional dependencies with fallback classes
class FallbackTurnstileMixin:
    """Fallback mixin if TurnstileMixin is not available."""

    def validate_turnstile(self, request):
        pass


class FallbackCacheMonitor:
    """Fallback class if CacheMonitor is not available."""

    def get_cache_stats(self):
        return {"detail": "Cache monitoring not available"}


class FallbackIndexAnalyzer:
    """Fallback class if IndexAnalyzer is not available."""

    @staticmethod
    def analyze_slow_queries(threshold):
        return {"detail": "Query analysis not available"}


# Try to import the real classes, use fallbacks if not available
try:
    from apps.accounts.mixins import TurnstileMixin
except ImportError:
    TurnstileMixin = FallbackTurnstileMixin

try:
    from apps.core.services.enhanced_cache_service import CacheMonitor
except ImportError:
    CacheMonitor = FallbackCacheMonitor

try:
    from apps.core.utils.query_optimization import IndexAnalyzer
except ImportError:
    IndexAnalyzer = FallbackIndexAnalyzer

# Export fallback classes for use in domain-specific modules
__all__ = [
    "TurnstileMixin",
    "CacheMonitor",
    "IndexAnalyzer",
    "FallbackTurnstileMixin",
    "FallbackCacheMonitor",
    "FallbackIndexAnalyzer",
]
