//! `POI` — per `data_model.md §3 Decision entities`.

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use uuid::Uuid;

use super::tier2::Tier2Evidence;
use super::vlm::VlmStatus;

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum VlmPipelineStatus {
    NotRequested,
    Pending,
    Ok,
    Timeout,
    SchemaInvalid,
    IpcError,
    Disabled,
}

impl From<VlmStatus> for VlmPipelineStatus {
    fn from(s: VlmStatus) -> Self {
        match s {
            VlmStatus::Ok => Self::Ok,
            VlmStatus::Timeout => Self::Timeout,
            VlmStatus::SchemaInvalid => Self::SchemaInvalid,
            VlmStatus::IpcError => Self::IpcError,
            VlmStatus::Disabled => Self::Disabled,
        }
    }
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Poi {
    pub id: Uuid,
    pub confidence: f32,
    pub mgrs: String,
    pub class: String,
    pub class_group: String,
    pub source_detection_ids: Vec<Uuid>,
    pub enqueued_at: DateTime<Utc>,
    pub priority: f32,
    pub decline_suppressed: bool,
    pub vlm_status: VlmPipelineStatus,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tier2_evidence: Option<Tier2Evidence>,
    pub deadline: DateTime<Utc>,
}
