//! `Frame`, `BoundingBox` — per `data_model.md §2 Perception entities`.

use std::sync::Arc;

use bytes::Bytes;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum PixelFormat {
    Nv12,
    Yuv420p,
    Rgb24,
}

#[derive(Debug, Clone)]
pub struct Frame {
    pub seq: u64,
    pub capture_ts_monotonic_ns: u64,
    pub decode_ts_monotonic_ns: u64,
    pub pixels: Arc<Bytes>,
    pub width: u32,
    pub height: u32,
    pub pix_fmt: PixelFormat,
    pub ai_locked: bool,
}

#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
pub struct BoundingBox {
    pub x_min: f32,
    pub y_min: f32,
    pub x_max: f32,
    pub y_max: f32,
}
