use anyhow::Result;
use std::path::PathBuf;
use crate::config::Profile;
pub trait Prompter {
fn ask_text(&mut self, label: &str, default: Option<&str>) -> Result<String>;
fn ask_choice(&mut self, label: &str, choices: &[String]) -> Result<usize>;
fn confirm(&mut self, label: &str, default: bool) -> Result<bool>;
fn ask_secret(&mut self, label: &str) -> Result<String>;
fn info(&mut self, msg: &str);
fn note(&mut self, msg: &str);
}
pub trait ConfigStore {
fn read(&self) -> Result<Option<String>>;
fn write(&self, contents: &str) -> Result<()>;
fn path(&self) -> PathBuf;
}
pub trait ShellRcWriter {
fn rc_path(&self) -> Option<PathBuf>;
fn append_export(&self, var: &str, val: &str) -> Result<AppendOutcome>;
}
#[derive(Debug, PartialEq, Eq)]
pub enum AppendOutcome {
Appended { path: PathBuf },
AlreadyPresent { path: PathBuf },
}
pub trait ConnectionTester {
fn test(&mut self, profile: &Profile) -> Result<TestOutcome>;
}
#[derive(Debug)]
pub struct TestOutcome {
pub bytes: usize,
pub latency_secs: f64,
pub attempts: u32,
}