use std::collections::HashSet;
use crate::AppModel;
use crate::boundary::reply::Reply;
use crate::boundary::{Query, dispatch::Deps};
use crate::cli_outbound::Cli;
use crate::nav::convs::{self, ConvRow};
pub(crate) fn forest(model: &AppModel, now_unix: i64) -> Vec<ConvRow> {
let Some(workspace) = model.focused_ws_name() else {
return Vec::new();
};
let deps: Deps = model.boundary_deps(&Cli::new("lernie"), &Cli::new("bl"));
let answered = match model.answer(&deps, &Query::Conversations { workspace }, now_unix) {
Ok(Reply::Conversations(rows)) => rows,
_ => Vec::new(),
};
model.echoed(answered, now_unix)
}
pub(crate) fn visible(model: &AppModel, now_unix: i64, expanded: &HashSet<String>) -> Vec<ConvRow> {
convs::visible(&forest(model, now_unix), expanded)
}
pub(crate) fn conversations(model: &AppModel, now_unix: i64) -> Vec<ConvRow> {
visible(model, now_unix, &HashSet::new())
}