Skip to main content

sightloom_analysis/
events.rs

1//! Extended zone analytics events layered above core enter/exit/cross.
2
3use sightloom_core::{ClassId, MediaTime, TrackId, ZoneId};
4
5/// Analytics events emitted by enhanced zone monitors.
6#[derive(Clone, Copy, Debug, PartialEq)]
7pub enum AnalyticsEvent {
8    /// A track entered a zone (mirrors core, with optional class filter context).
9    Entered {
10        /// Track identifier.
11        track_id: TrackId,
12        /// Zone identifier.
13        zone_id: ZoneId,
14        /// Optional class at entry.
15        class_id: Option<ClassId>,
16    },
17    /// A track exited a zone.
18    Exited {
19        /// Track identifier.
20        track_id: TrackId,
21        /// Zone identifier.
22        zone_id: ZoneId,
23        /// Optional class at exit.
24        class_id: Option<ClassId>,
25    },
26    /// Dwell timing started after hysteresis confirmed presence.
27    DwellStarted {
28        /// Track identifier.
29        track_id: TrackId,
30        /// Zone identifier.
31        zone_id: ZoneId,
32        /// Media time when dwell began.
33        at: MediaTime,
34    },
35    /// Dwell timing ended; includes total dwell nanoseconds.
36    DwellEnded {
37        /// Track identifier.
38        track_id: TrackId,
39        /// Zone identifier.
40        zone_id: ZoneId,
41        /// Total dwell duration in nanoseconds.
42        duration_ns: i64,
43        /// Visit count for this track in this zone after this visit.
44        visit_count: u32,
45    },
46    /// Occupancy changed inside the zone.
47    OccupancyChanged {
48        /// Zone identifier.
49        zone_id: ZoneId,
50        /// Current number of confirmed occupants.
51        occupancy: u32,
52    },
53}