dodil/erp-brick-projects

src/brick_projects/domain/events.py

"""What happened, as the history records it (pj_event). Every transition records one; the repository
appends them when the aggregate is saved, keyed on the version that saved them, so a save that is retried
records nothing twice. Nothing publishes them: a brick that needs another to react calls its seam.
"""
from dataclasses import dataclass


@dataclass(frozen=True)
class Moved:
    """One step of an item's or a project's process: its key (the BPMN task), the states it moved between
    (the same state for a step that changes none), who, and the detail a person reads."""
    subject_id: str
    kind: str
    from_state: str
    to_state: str
    by: str = ""
    detail: str = ""