use std::time::Duration;
use crate::state::{Link, Said};
use crate::ui::Model;
use serde_json::json;
pub(super) fn asking(model: &Model) -> Link {
let link = Link::new(Duration::from_millis(1));
let mut model = model.clone();
link.settle(&mut model);
link
}
pub(super) fn reported(link: &Link) -> Vec<(String, Said)> {
let mut model = Model::default();
let mut out = Vec::new();
link.settle(&mut model);
out.extend(
model
.notice
.map(|n| (String::new(), Said::Unreachable(n.line()))),
);
out.extend(
model
.roster
.into_iter()
.map(|chunk| (chunk.channel.name, Said::Frame(json!(chunk.walls.len())))),
);
out
}
mod board;
mod clients;
mod config;
mod login;
mod nesting;
mod union;