package brain_control import "time" const ( SourceConfigVersion = "yovision.source-config/v1" RuntimeStatusVersion = "yovision.runtime-status/v1" ) type Point struct { X float64 `json:"x"` Y float64 `json:"y"` } type Profile struct { ID string `json:"id"` Width int `json:"width"` Height int `json:"height"` Encoding string `json:"encoding"` FrameRate float64 `json:"frame_rate"` } type AreaRule struct { ID string `json:"id"` Version int64 `json:"version"` Kind string `json:"kind"` Enabled bool `json:"enabled"` Points []Point `json:"points"` } type DirectionalLineRule struct { ID string `json:"id"` Version int64 `json:"version"` Kind string `json:"kind"` Enabled bool `json:"enabled"` Start Point `json:"start"` End Point `json:"end"` TriggerDirection string `json:"trigger_direction"` } type SourceConfig struct { SchemaVersion string `json:"schema_version"` ConfigID string `json:"config_id"` Revision int64 `json:"revision"` PublishedAt time.Time `json:"published_at"` EffectiveAt time.Time `json:"effective_at"` Site struct { ID string `json:"id"` } `json:"site"` LogicalDevice struct { ID string `json:"id"` } `json:"logical_device"` Profile Profile `json:"profile"` Media struct { Ref string `json:"ref"` Transport string `json:"transport"` } `json:"media"` RuleSet struct { Version string `json:"version"` State string `json:"state"` ProfileBinding struct { ProfileID string `json:"profile_id"` Width int `json:"width"` Height int `json:"height"` } `json:"profile_binding"` Areas []AreaRule `json:"areas"` DirectionalLines []DirectionalLineRule `json:"directional_lines"` } `json:"rule_set"` Integrity struct { Algorithm string `json:"algorithm"` Value string `json:"value"` } `json:"integrity"` } // SourceFacts is an explicit, credential-free boundary DTO. Callers map their // GORM entities into it; database models are never serialized as a contract. type SourceFacts struct { ConfigID, SiteID, LogicalDeviceID, MediaRouteID, MediaPath string Revision int64 PublishedAt, EffectiveAt time.Time Profile Profile RuleSetVersion string Disabled, NeedsRecalibration bool Areas []AreaRule DirectionalLines []DirectionalLineRule } type ReplayToken struct { Principal string `gorm:"size:128;primaryKey"` TokenID string `gorm:"size:96;primaryKey"` ExpiresAt time.Time `gorm:"not null;index"` CreatedAt time.Time `gorm:"not null"` } func (ReplayToken) TableName() string { return "sense_brain_runtime_replay_tokens" } type RuntimeProjection struct { BrainInstanceRef string `gorm:"size:128;primaryKey"` StatusID string `gorm:"size:36;not null;uniqueIndex"` Sequence int64 `gorm:"not null"` ObservedAt time.Time `gorm:"not null;index"` ReceivedAt time.Time `gorm:"not null"` RuntimeState string `gorm:"size:32;not null"` RuntimeVersion string `gorm:"size:64;not null"` ModelRef string `gorm:"size:128;not null"` ModelVersion string `gorm:"size:64;not null"` HealthOverall string `gorm:"size:32;not null"` ExpectedRevisionsJSON string `gorm:"type:jsonb;not null"` ConfigurationsJSON string `gorm:"type:jsonb;not null"` HealthJSON string `gorm:"type:jsonb;not null"` InputsJSON string `gorm:"type:jsonb;not null"` WasOffline bool `gorm:"not null;default:false"` CreatedAt time.Time UpdatedAt time.Time } func (RuntimeProjection) TableName() string { return "sense_brain_runtime_projections" } type SourceRevision struct { ConfigID string `gorm:"size:128;primaryKey"` Revision int64 `gorm:"not null"` UpdatedAt time.Time } func (SourceRevision) TableName() string { return "sense_brain_source_revisions" }