use std::collections::BTreeMap; use std::fmt; use std::path::PathBuf; use std::time::{Duration, SystemTime}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum GameEventType { Kill, Death, Assist, RoundWin, MatchWin, Objective, MultiKill, Bookmark, Unknown(String), } impl fmt::Display for GameEventType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let value = match self { Self::Kill => "kill", Self::Death => "death", Self::Assist => "assist", Self::RoundWin => "round_win", Self::MatchWin => "match_win", Self::Objective => "objective", Self::MultiKill => "multi_kill", Self::Bookmark => "bookmark", Self::Unknown(value) => value, }; f.write_str(value) } } #[derive(Debug, Clone, PartialEq)] pub struct GameEvent { pub id: String, pub game_id: String, pub session_id: String, pub event_type: GameEventType, pub occurred_at: SystemTime, pub confidence: f32, pub player: Option, pub metadata: BTreeMap, } impl GameEvent { pub fn new( id: impl Into, game_id: impl Into, session_id: impl Into, event_type: GameEventType, occurred_at: SystemTime, ) -> Self { Self { id: id.into(), game_id: game_id.into(), session_id: session_id.into(), event_type, occurred_at, confidence: 1.0, player: None, metadata: BTreeMap::new(), } } } #[derive(Debug, Clone, PartialEq, Eq)] pub enum ClipSource { ManualHotkey, AutoEvent, FullSessionBookmark, Imported, } #[derive(Debug, Clone, PartialEq, Eq)] pub enum UploadProvider { Catbox, Litterbox, Lustful, CustomHttp, } impl fmt::Display for UploadProvider { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let value = match self { Self::Catbox => "catbox", Self::Litterbox => "litterbox", Self::Lustful => "lustful", Self::CustomHttp => "custom_http", }; f.write_str(value) } } #[derive(Debug, Clone, PartialEq, Eq)] pub struct Clip { pub id: String, pub title: Option, pub session_id: String, pub game_id: String, pub path: PathBuf, pub thumbnail_path: Option, pub created_at: SystemTime, pub duration: Duration, pub source: ClipSource, pub event_type: Option, pub tags: Vec, pub upload_url: Option, pub upload_provider: Option, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct UploadHistoryEntry { pub id: i64, pub clip_id: String, pub provider: String, pub status: String, pub url: Option, pub error: Option, pub attempted_at: SystemTime, } #[derive(Debug, Clone, PartialEq, Eq)] pub enum RecordingStatus { WaitingForGame, Buffering, RecordingSession, Clipping, Processing, StorageLow, Error(String), }