Skip to main content

unifly_api/model/
common.rs

1// ── Common types shared across the domain model ──
2
3use serde::{Deserialize, Serialize};
4
5/// Origin metadata -- where this entity came from.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7pub enum EntityOrigin {
8    UserDefined,
9    SystemDefined,
10    Derived,
11    Orchestrated,
12}
13
14/// Which API provided this data (internal bookkeeping, not exposed in display).
15#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
16pub enum DataSource {
17    #[default]
18    IntegrationApi,
19    LegacyApi,
20    WebSocket,
21    Merged,
22}
23
24/// Bandwidth measurement.
25#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize)]
26pub struct Bandwidth {
27    pub tx_bytes_per_sec: u64,
28    pub rx_bytes_per_sec: u64,
29}
30
31/// Throughput over a time period.
32#[derive(Debug, Clone, Copy, Default, Serialize, Deserialize)]
33pub struct Throughput {
34    pub tx_bytes: u64,
35    pub rx_bytes: u64,
36    pub period: std::time::Duration,
37}