"""PyAuthz — Framework-agnostic authorization for modern Python.

RBAC, ABAC, and Policy-Based Access Control — unified, typed, Pydantic-native,
async-first, and auditable out of the box.

Quick Example:
    from pyauthz import PyAuthz, Subject, Resource, Role

    rp = PyAuthz()
    rp.add_role(Role(name="admin", permissions=["*:*"]))
    user = Subject(id="alice", roles=["admin"])
    doc = Resource(id="doc-1", type="documents")
    rp.is_allowed(user, "read", doc)  # True
"""

from pyauthz.audit.logger import AuditLogger, JsonExporter
from pyauthz.audit.models import AuditEvent, MutationAction, MutationEvent
from pyauthz.core.breakglass import BreakGlassEvent, BreakGlassManager
from pyauthz.core.cache import DecisionCache
from pyauthz.core.decision import Decision
from pyauthz.core.delegation import Delegation, DelegationStore
from pyauthz.core.diff import DiffReport, PolicyChange, diff_policies
from pyauthz.core.engine import PyAuthz
from pyauthz.core.errors import ConfigError, Denied, PolicyVersionError, SchemaError
from pyauthz.core.explain import explain_denial
from pyauthz.core.lint import LintIssue, Severity, lint_policies
from pyauthz.core.simulation import SimulationResult, simulate
from pyauthz.core.temporal import TemporalRole, TemporalRoleStore
from pyauthz.core.tenancy import TenantManager
from pyauthz.filtering.compiler import FilterResult
from pyauthz.filtering.expressions import (
    AllowAll,
    And,
    Compare,
    DenyAll,
    FilterExpression,
    Not,
    Or,
)
from pyauthz.models.action import Effect
from pyauthz.models.condition import Condition
from pyauthz.models.context import AccessRequest
from pyauthz.models.permission import Permission
from pyauthz.models.policy import Policy
from pyauthz.models.resource import Resource
from pyauthz.models.role import Role
from pyauthz.models.subject import Subject
from pyauthz.storage.watcher import PolicyWatcher

__version__ = "0.9.0"

__all__ = [
    # Engine
    "PyAuthz",
    # Models
    "Subject",
    "Resource",
    "Role",
    "Permission",
    "Policy",
    "Effect",
    "Condition",
    "AccessRequest",
    "Decision",
    # Errors
    "Denied",
    "SchemaError",
    "ConfigError",
    "PolicyVersionError",
    # Audit
    "AuditLogger",
    "JsonExporter",
    "AuditEvent",
    "MutationEvent",
    "MutationAction",
    # Filtering
    "FilterResult",
    "FilterExpression",
    "AllowAll",
    "DenyAll",
    "Compare",
    "And",
    "Or",
    "Not",
    # Watcher
    "PolicyWatcher",
    # Advanced patterns
    "DecisionCache",
    "TenantManager",
    "TemporalRole",
    "TemporalRoleStore",
    "Delegation",
    "DelegationStore",
    "SimulationResult",
    "simulate",
    # Add-ons
    "BreakGlassManager",
    "BreakGlassEvent",
    "DiffReport",
    "PolicyChange",
    "diff_policies",
    "LintIssue",
    "Severity",
    "lint_policies",
    "explain_denial",
    # Version
    "__version__",
]
