Class Diagram
UML class diagrams of internal/domain/**, plus the hexagonal ports and
adapters around it. Part of the DDD artifact pack.
Type, field and method names are the real Go identifiers; Go slices are
written List~T~ and the unexported fields are shown with -.
1. Aggregates, entities and value objects
Source: internal/domain/processpath/process_path.go,
internal/domain/cptschedule/cpt_schedule.go,
internal/domain/processflow/process_flow.go,
internal/domain/shared/shared.go, internal/domain/shared/eligibility.go.
Omits: read accessors (MatchPrefix(), Cutoffs(), ...), the private
validate/equality helpers and the Err... sentinels (listed on the
Aggregate Design Canvas).
maxUnitsPerLine is a *int (nil means unbounded). Unset is
DestinationLocationRoleUnset = "". Intake (internal/domain/shared/intake.go,
ADR 0034) is a value object: a validated,
duplicate-free, sorted set of DemandSource (CUSTOMER_ORDER,
STOCK_TRANSFER, SLOT_RELOCATION, INVENTORY_CONTROL, REPLENISHMENT); the empty set is
valid. It is drawn as a field, not a separate box, to keep the diagram narrow. The Cutoff to PathId link is a
reference by id only: CPTSchedule never holds a ProcessPath; the
Active-path rule lives in the DefineCPTSchedule use case.
2. Domain events
Source: internal/domain/shared/events.go,
internal/domain/cptschedule/events.go. Omits: the wire structs
(ProcessPathData, CPTScheduleData; see Domain Events).
The three path events live in shared; CPTScheduleChanged and
CutoffSnapshot live in cptschedule; the three flow events and
StageSnapshot live in processflow (internal/domain/processflow/events.go),
and each carries the same State (FlowId, Name, Stages, Status,
Version) plus At; the wire struct is ProcessFlowData. Events are built in the use cases,
not by the aggregates (the flow events come from the aggregate's
DefinedEvent / RevisedEvent / RetiredEvent methods, called by the use cases).
3. Ports and adapters
Source: internal/application/ports/ports.go,
internal/application/usecases/*.go,
internal/adapters/inbound/http/server.go,
internal/adapters/inbound/mcp/tools.go,
internal/adapters/outbound/{postgres,memory,events,kafka,telemetry},
cmd/pathmgmt/main.go. Omits: RevisePath, DeactivatePath and
DefineCPTSchedule also depend on EventPublisher, UnitOfWork and
Clock (left out to keep the diagram readable); the analytics side
(internal/analytics/report ports ReportStore/ProjectionStore,
analyticsstore, the pathmgmt-projector Kafka consumer and the
pathmgmt-reports HTTP handler); the outbox relay and sweeper, which are
driven by cmd/pathmgmt, not by a port. The only publisher a binary wires is
OutboxPublisher (ADR 0037); FanOutPublisher (kafka.NewSharedIdFanOut)
and LogPublisher remain as test doubles.