use super::metrics::SessionMetrics;
use std::time::Instant;

pub struct SessionLog {
    pub id: String,
    pub started_at: Instant,
    pub metrics: SessionMetrics,
}

impl SessionLog {
    pub fn new() -> Self {
        Self {
            id: uuid::Uuid::new_v4().to_string(),
            started_at: Instant::now(),
            metrics: SessionMetrics::default(),
        }
    }

    pub fn elapsed_secs(&self) -> u64 {
        self.started_at.elapsed().as_secs()
    }
}

impl Default for SessionLog {
    fn default() -> Self {
        Self::new()
    }
}
