# -*- coding: utf-8 -*-
"""
Accounts App Configuration

This module contains the Django app configuration for the accounts application.
It defines the app name, verbose name, and handles app-specific initialization.

The AccountsConfig class is responsible for:
- Setting up the app configuration
- Defining the default auto field type
- Importing signal handlers when the app is ready
- Setting up any app-specific initialization logic

Author: Adtlas Development Team
Version: 1.0.0
Created: 2024
"""

from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _


class AccountsConfig(AppConfig):
    """
    Django app configuration for the accounts application.
    
    This class configures the accounts app and handles initialization
    tasks such as importing signal handlers and setting up permissions.
    
    Attributes:
        default_auto_field (str): The default auto field type for models
        name (str): The full Python path to the application
        verbose_name (str): Human-readable name for the application
    """
    
    # Default auto field type for model primary keys
    default_auto_field = 'django.db.models.BigAutoField'
    
    # Full Python path to the application
    name = 'apps.accounts'
    
    # Human-readable name for the application (supports internationalization)
    verbose_name = _('Accounts & User Management')
    
    def ready(self):
        """
        Called when Django starts and the app is ready.
        
        This method is used to perform any app-specific initialization
        that needs to happen when Django starts up. It imports signal
        handlers to ensure they are connected properly.
        
        Note:
            This method should not perform any database operations
            as the database may not be ready yet.
        """
        try:
            # Import signal handlers to ensure they are connected
            import apps.accounts.signals  # noqa: F401
        except ImportError:
            # Signal handlers are optional, so we don't fail if they don't exist
            pass
        
        # Import any other initialization code here
        # For example: custom permission setup, cache initialization, etc.