use std::collections::BTreeMap;
use std::sync::Arc;
use std::time::Duration;
use chrono::{DateTime, TimeDelta, Utc};
use crate::app::{Awaited, Wanted};
use crate::config::Scope;
use crate::model::snapshot::{a_provider, Filter, ProviderState, Snapshot, TrackerFailure, Tree};
pub(in crate::tui) const A_MOMENT: Duration = Duration::from_secs(5);
pub(in crate::tui) fn atlas() -> Wanted {
Wanted::Project("atlas".to_string())
}
pub(in crate::tui) fn ferry() -> Wanted {
Wanted::Project("ferry".to_string())
}
pub(in crate::tui) fn reading(wanted: Wanted, asked_at: DateTime<Utc>) -> Awaited {
Awaited {
wanted,
asked_at,
patience: PATIENCE,
}
}
pub(in crate::tui) const PATIENCE: TimeDelta = TimeDelta::seconds(30);
pub(in crate::tui) fn a_snapshot() -> Snapshot {
let tree = Arc::new(Tree {
project: "atlas".to_string(),
root: "a-1".to_string(),
title: "the only tree there is".to_string(),
..Tree::tracker_unreachable("atlas", "a-1", TrackerFailure::Unavailable)
});
Snapshot {
generated_at: Utc::now(),
agents: a_provider(ProviderState::Answering),
filter: Filter::LiveAgents,
trees: vec![Arc::clone(&tree)],
hidden_trees: Vec::new(),
failed_projects: Vec::new(),
unattributed: Vec::new(),
unconfigured: Vec::new(),
conflicts: Vec::new(),
projects_named_without_git: Vec::new(),
read_at: BTreeMap::new(),
collected: vec![tree],
projects: vec!["atlas".to_string()],
scope: Scope::default(),
}
}