pub mod cloud;
pub mod emitter;
pub mod local;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Beacon {
pub skill_id: String,
pub tokens_used: usize,
pub tokens_saved: usize,
pub duration_ms: u64,
pub timestamp: DateTime<Utc>,
}
impl Beacon {
pub fn new(
skill_id: impl Into<String>,
tokens_used: usize,
tokens_saved: usize,
duration_ms: u64,
) -> Self {
Self {
skill_id: skill_id.into(),
tokens_used,
tokens_saved,
duration_ms,
timestamp: Utc::now(),
}
}
}
pub trait BeaconEmitter: Send + Sync {
fn emit(&self, beacon: &Beacon);
}