from __future__ import annotations

from django.apps import AppConfig
from django.utils.module_loading import autodiscover_modules


class ReportingConfig(AppConfig):
    default_auto_field = "django.db.models.BigAutoField"
    name = "simorgh.apps.reporting"
    label = "reporting"
    verbose_name = "Reporting Engine"

    def ready(self) -> None:
        # Register reporting permissions in the IAM registry.
        from simorgh.apps.reporting import permissions  # noqa: F401

        # Each module may expose a ``reports.py`` that registers
        # report/KPI/dashboard specs on the reporting registries.
        autodiscover_modules("reports")

        # Wire Event Bus subscriptions so report events trigger actions.
        from simorgh.apps.reporting import events  # noqa: F401
