use std::sync::Arc;
use std::time::SystemTime;
use visual_cortex_vision::DetectorOutput;
#[derive(Debug, Clone)]
pub struct Event {
pub watcher: Arc<str>,
pub timestamp: SystemTime,
pub kind: EventKind,
}
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum EventKind {
Matched { output: DetectorOutput },
Changed {
old: Option<DetectorOutput>,
new: DetectorOutput,
},
ThresholdCrossed {
value: f64,
direction: ThresholdDirection,
},
TemplateAppeared { score: f32 },
TemplateVanished,
WatcherDegraded { consecutive_errors: u32 },
TargetLost,
TargetReattached,
}
impl EventKind {
pub fn is_session_level(&self) -> bool {
matches!(self, EventKind::TargetLost | EventKind::TargetReattached)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ThresholdDirection {
Entered,
Exited,
}