Coverage for src/lexigram/admin/hooks.py: 100%
12 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-21 14:56 +0800
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-21 14:56 +0800
1"""Root hook payload surface for lexigram-admin.
3Defines canonical payload dataclasses for admin-panel hook points. Actual
4hook registration and invocation use the framework's string-keyed
5``HookRegistryProtocol`` action/filter APIs.
6"""
8from __future__ import annotations
10from dataclasses import dataclass
12__all__ = [
13 "AdminPanelStartedHook",
14 "AdminPanelStoppedHook",
15 "AdminResourceAccessedHook",
16]
19@dataclass(frozen=True, kw_only=True)
20class AdminPanelStartedHook:
21 """Payload fired after the admin panel has finished its startup sequence."""
24@dataclass(frozen=True, kw_only=True)
25class AdminPanelStoppedHook:
26 """Payload fired after an orderly admin panel shutdown completes."""
29@dataclass(frozen=True, kw_only=True)
30class AdminResourceAccessedHook:
31 """Payload fired when an admin resource page is accessed.
33 Attributes:
34 resource_name: Registered name of the admin resource (e.g. ``"User"``).
35 action: CRUD action being performed (e.g. ``"list"``, ``"change"``).
36 user_id: Identifier of the admin user performing the action.
37 """
39 resource_name: str
40 action: str
41 user_id: str