The following definitions apply to classes for business rules. Notice that they are meant to be pure business objects, not bound to anything in particular. They aren't models of an ORM, or objects of an external framework, and so on. The application should work with these objects (or objects with the same criteria).
In each case, the dosctring documents the purpose of each class, according to the business rule:
from typing import Unionclass DispatchedOrder: """An order that was just created and notified to start its delivery.""" status = "dispatched" def __init__(self, when): self._when = when def message(self) -> dict: return { "status": self.status, "msg": "Order was dispatched on {0}".format( self._when.isoformat() ), }