"""
Audit core: ``build_plan`` and ``apply_plan``.

``build_plan`` materializes a frozen ``AuditPlan`` from the
current state of AA + Discord; ``apply_plan`` walks the plan's
findings and applies the resolved action for each, with
re-classify + Discord API calls wrapped in a per-finding
``transaction.atomic`` + ``select_for_update`` block.

The very first thing ``apply_plan`` does after loading the plan
is consult the first-run lock and coerce the policy to ``REPORT``
when no ``InitialAuditAcknowledgement`` exists. This is the
single chokepoint for the safety guarantee.

The module is split internally into private ``_<topic>.py``
files; importers should always use this package's flat namespace
(``from aa_discord_audit.audit import build_plan, apply_plan,
AuditPlan, OrphanFinding``), not the private submodules.
"""

from __future__ import annotations

from ._apply import apply_plan
from ._plan import IdempotencyConflictError, build_plan
from ._types import (
    AppliedAction,
    AuditPlan,
    AuditResult,
    OrphanFinding,
    SkipReason,
)

__all__ = [
    "AppliedAction",
    "AuditPlan",
    "AuditResult",
    "IdempotencyConflictError",
    "OrphanFinding",
    "SkipReason",
    "apply_plan",
    "build_plan",
]
