"""Domain enumerations. Roles are a fixed enum on `user.role`, not a `role` table — with 4 roles that never change at runtime a lookup table adds a join to every request and buys nothing. (See report §13.2.) """ from enum import StrEnum class Role(StrEnum): """Operational roles (MR/AM/GM) plus the technical ADMIN role. ADMIN sits OUTSIDE the business hierarchy. It provisions users and masters but can never approve a report or read report content (report §8, SEC-2). """ ADMIN = "ADMIN" GM = "GM" AM = "AM" MR = "MR" class DCRStatus(StrEnum): """MR submits, the Area Manager approves or returns it. `RETURNED` captures the correction loop, and `APPROVED` remains terminal and immutable. There is no General Manager step. """ DRAFT = "DRAFT" PENDING_AM = "PENDING_AM" RETURNED = "RETURNED" APPROVED = "APPROVED" #: Statuses in which the owning MR may still change report data (V9). EDITABLE_STATUSES: frozenset[DCRStatus] = frozenset( {DCRStatus.DRAFT, DCRStatus.RETURNED} ) class WorkflowAction(StrEnum): SUBMIT = "SUBMIT" RETURN = "RETURN" APPROVE = "APPROVE" class CallOutcome(StrEnum): MET = "MET" NOT_AVAILABLE = "NOT_AVAILABLE" RESCHEDULED = "RESCHEDULED" class ConversionStatus(StrEnum): """Core-doctor conversion. Stored as a column on doctor_call, not a table.""" NOT_STARTED = "NOT_STARTED" IN_PROGRESS = "IN_PROGRESS" CONVERTED = "CONVERTED" LOST = "LOST" class AuditAction(StrEnum): CREATE = "CREATE" UPDATE = "UPDATE" DELETE = "DELETE" SUBMIT = "SUBMIT" FORWARD = "FORWARD" RETURN = "RETURN" APPROVE = "APPROVE" ASSIGN = "ASSIGN" LOGIN = "LOGIN" DEACTIVATE = "DEACTIVATE" class EntityType(StrEnum): USER = "user" HEADQUARTERS = "headquarters" DOCTOR = "doctor" CHEMIST = "chemist" DCR = "dcr" PRODUCT = "product"