use anyhow::Result;
use config::Config;
use map_core::folders::Folder;
use transport::iroh::Endpoint;
use crate::commands::conn;
pub(crate) fn confirmation(number: &str, handle: &str) -> String {
format!("sent to {number} (handle {handle})")
}
pub(crate) async fn run(
cfg: &Config,
endpoint: Option<&Endpoint>,
device: Option<&str>,
number: String,
message: String,
) -> Result<String> {
let mut client = conn::connect_map(cfg, endpoint, device).await?;
client.set_folder(Folder::Outbox).await?;
let handle = client.push_message(&number, &message).await?;
Ok(confirmation(&number, &handle))
}