package realtime import ( "time" "lingniu-vehicle-ingest/go/vehicle-gateway/internal/envelope" ) type Snapshot struct { VehicleKey string `json:"vehicle_key"` VIN string `json:"vin"` Protocol envelope.Protocol `json:"protocol,omitempty"` Protocols []envelope.Protocol `json:"protocols,omitempty"` EventID string `json:"event_id,omitempty"` EventTimeMS int64 `json:"event_time_ms"` ReceivedAtMS int64 `json:"received_at_ms"` SourceEndpoint string `json:"source_endpoint,omitempty"` Fields map[string]any `json:"fields,omitempty"` FieldTimesMS map[string]int64 `json:"field_times_ms,omitempty"` UpdatedAtMS int64 `json:"updated_at_ms"` } type OnlineStatus struct { VehicleKey string `json:"vehicle_key"` VIN string `json:"vin"` Online bool `json:"online"` LastSeenMS int64 `json:"last_seen_ms"` Protocols []envelope.Protocol `json:"protocols,omitempty"` TTLSeconds int64 `json:"ttl_seconds"` } type Config struct { OnlineTTL time.Duration } func (c Config) ttl() time.Duration { if c.OnlineTTL <= 0 { return 10 * time.Minute } return c.OnlineTTL }