Files

25 lines
1.2 KiB
Go

package event
import (
"encoding/json"
"time"
)
// Event is an immutable Bell business fact. It intentionally does not embed
// GoAdmin's mutable/soft-delete model fields.
type Event struct {
ID string `json:"id" gorm:"type:uuid;primaryKey"`
ProducerID string `json:"producerId" gorm:"size:128;not null;uniqueIndex:bell_event_key"`
SourceEventID string `json:"sourceEventId" gorm:"size:256;not null;uniqueIndex:bell_event_key"`
EventType string `json:"eventType" gorm:"size:128;not null;index"`
OccurredAt time.Time `json:"occurredAt" gorm:"type:timestamptz;not null;index"`
Location string `json:"location" gorm:"size:256;not null;index"`
Severity string `json:"severity" gorm:"size:16;not null;index"`
EvidenceRef *string `json:"evidenceRef,omitempty" gorm:"size:512"`
NormalizedPayload json.RawMessage `json:"normalizedPayload" gorm:"type:jsonb;not null"`
PayloadSHA256 string `json:"-" gorm:"type:char(64);not null"`
ReceivedAt time.Time `json:"receivedAt" gorm:"type:timestamptz;not null;index"`
}
func (Event) TableName() string { return "bell_events" }