use std::collections::HashMap;
use std::path::PathBuf;
use oxi_sdk::{HubKind, HubStatus};
use crate::app::agent_hub_registry::HubRegistry;
#[derive(Debug, Clone)]
pub struct HubRow {
pub id: String,
pub kind: HubKind,
pub status: HubStatus,
pub display_name: String,
pub current_task: Option<String>,
pub age_text: String,
pub session_file: Option<PathBuf>,
}
#[derive(Debug, Clone)]
pub enum HubView {
Table,
Transcript { agent_id: String },
}
#[derive(Debug)]
pub struct HubState {
pub rows: Vec<HubRow>,
pub view: HubView,
pub selected: usize,
pub row_order: HashMap<String, usize>,
pub transcript_scroll: isize,
pub transcript_follow: bool,
}
impl HubState {
pub fn from_registry(reg: &HubRegistry, now_ms: u64) -> Vec<HubRow> {
reg.snapshot()
.into_iter()
.map(|(id, e)| HubRow {
age_text: e.age_text(now_ms),
id,
kind: e.kind,
status: e.status,
display_name: e.display_name,
current_task: e.current_task,
session_file: e.session_file,
})
.collect()
}
}