"""Platform-level Automation Engine.

Architectural Principles (task 3.1.3)
--------------------------------------
1. **Event-only triggers** — rules are never polled; they listen exclusively to
   events published on the internal Event Bus (``simorgh.apps.events``).
   Scheduled rules use Celery Beat to *emit* a synthetic event rather than
   calling the executor directly, keeping a single dispatch path.

2. **Action Registry** — every module that wants to expose automation actions
   must ``register_action(ActionSpec(...))`` from its own ``apps.py.ready()``.
   The executor never imports modules by name at runtime.

3. **Idempotency / retry-safety** — ``AutomationExecution`` is guarded by a
   (rule, trigger_event, idempotency_key) unique constraint.  Re-delivering
   the same event is a no-op.  Each action handler is expected to be
   idempotent; the executor records per-action results so a partial retry
   skips already-succeeded actions.

Sub-modules
-----------
- :mod:`~simorgh.apps.automation.models`      — AutomationRule, AutomationExecution, AutomationTemplate
- :mod:`~simorgh.apps.automation.registry`    — ActionSpec dataclass + global registry
- :mod:`~simorgh.apps.automation.executor`    — execute_rule(), sync + async entry points
- :mod:`~simorgh.apps.automation.selectors`   — read-only query helpers
- :mod:`~simorgh.apps.automation.services`    — write services (create/update/toggle rule)
- :mod:`~simorgh.apps.automation.events`      — Event Bus subscriptions
- :mod:`~simorgh.apps.automation.permissions` — IAM permission codenames
"""
