package domain import ( "time" ) // Event represents a system event type Event struct { ID string `json:"id"` Type EventType `json:"type"` EntityID string `json:"entity_id"` OrgID string `json:"org_id"` UserID string `json:"user_id,omitempty"` Timestamp time.Time `json:"timestamp"` Payload map[string]interface{} `json:"payload"` } // EventType represents different types of events type EventType string const ( EventTypeResourceFlowCreated EventType = "resource_flow.created" EventTypeResourceFlowUpdated EventType = "resource_flow.updated" EventTypeResourceFlowDeleted EventType = "resource_flow.deleted" EventTypeOrganizationUpdated EventType = "organization.updated" EventTypeMatchCreated EventType = "match.created" EventTypeMatchUpdated EventType = "match.updated" EventTypeMatchStatusChanged EventType = "match.status_changed" EventTypeMatchDeleted EventType = "match.deleted" EventTypeNegotiationAdded EventType = "negotiation.added" EventTypeNegotiationUpdated EventType = "negotiation.updated" ) // EventBus defines the interface for event publishing and subscribing type EventBus interface { Publish(event Event) error Subscribe(pattern string, handler func(Event) error) error Close() error }