"""Core Management Commands

Django management commands for the Adtlas Core module.
This package contains all management commands for system administration,
maintenance, monitoring, and utility operations.

Command Structure:
    Each command is implemented as a separate module with a Command class
    that inherits from Django's BaseCommand.

Command Categories:
    - System: Health checks, backups, data migration
    - Configuration: Config management and validation
    - Maintenance: Cache clearing, database optimization
    - Monitoring: Status reports, performance analysis
    - Utilities: Data import/export, test data generation

Usage:
    python manage.py <command_name> [options]

Logging:
    All commands use structured logging with appropriate levels:
    - INFO: Normal operation messages
    - WARNING: Non-critical issues
    - ERROR: Critical errors
    - DEBUG: Detailed debugging information

Error Handling:
    Commands implement comprehensive error handling:
    - Graceful degradation
    - Detailed error messages
    - Proper exit codes
    - Rollback mechanisms where applicable

Security:
    Commands follow security best practices:
    - Input validation
    - Permission checks
    - Secure file operations
    - Audit logging
"""

__version__ = '1.0.0'
__author__ = 'Adtlas Development Team'
__description__ = 'Core management commands for Adtlas platform'

# Command registration and metadata
COMMAND_REGISTRY = {}


def register_command(name: str, command_class, metadata: dict = None):
    """
    Register a management command.
    
    Args:
        name: Command name
        command_class: Command class
        metadata: Optional command metadata
    """
    COMMAND_REGISTRY[name] = {
        'class': command_class,
        'metadata': metadata or {},
    }


def get_registered_commands():
    """
    Get all registered commands.
    
    Returns:
        Dictionary of registered commands
    """
    return COMMAND_REGISTRY.copy()


def is_command_registered(name: str) -> bool:
    """
    Check if a command is registered.
    
    Args:
        name: Command name
        
    Returns:
        True if command is registered
    """
    return name in COMMAND_REGISTRY


# Export public interface
__all__ = [
    'register_command',
    'get_registered_commands', 
    'is_command_registered',
    'COMMAND_REGISTRY',
]