use super::super::display_name;
use super::super::flight::Flight;
use crate::git_tree::AgentState;
use crate::nav::convs::Tone;
use crate::projects::join::JoinState;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ConvBall {
pub id: String,
pub state: Option<JoinState>,
pub title: Option<String>,
pub badge: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ConvRow {
pub root_id: String,
pub state: AgentState,
pub uncertain: bool,
pub preview: String,
pub age_secs: i64,
pub flight: Option<Flight>,
pub attention: usize,
pub members: usize,
pub depth: usize,
pub direct: usize,
pub ball: Option<ConvBall>,
pub name: Option<String>,
pub name_display_only: bool,
pub verdict: Option<crate::monitor::Check>,
pub stoppable: bool,
pub stop_children: bool,
pub tone: Tone,
}
impl ConvRow {
pub fn has_children(&self) -> bool {
self.members > 1
}
pub fn total(&self) -> usize {
self.members.saturating_sub(1)
}
pub fn display_name(&self) -> String {
display_name(self.name.as_deref(), &self.preview, &self.root_id)
}
pub fn subtitle(&self) -> String {
match self.name {
Some(_) => self.preview.clone(),
None => String::new(),
}
}
}