use crate::{ArrangementInfo, UpdateCheckResult};
use par_term_config::{Profile, ProfileId};
pub trait ProfileOps {
fn get_profiles(&self) -> Vec<Profile>;
fn save_profiles(&mut self, profiles: Vec<Profile>) -> anyhow::Result<()>;
fn get_profile(&self, id: &ProfileId) -> Option<Profile>;
fn upsert_profile(&mut self, profile: Profile);
fn delete_profile(&mut self, id: &ProfileId) -> bool;
fn get_available_shells(&self) -> Vec<String>;
}
pub trait ArrangementOps {
fn get_arrangements(&self) -> Vec<ArrangementInfo>;
fn save_arrangement(&mut self, name: &str) -> anyhow::Result<uuid::Uuid>;
fn restore_arrangement(&mut self, id: uuid::Uuid) -> anyhow::Result<()>;
fn delete_arrangement(&mut self, id: uuid::Uuid) -> anyhow::Result<()>;
fn rename_arrangement(&mut self, id: uuid::Uuid, new_name: &str) -> anyhow::Result<()>;
fn arrangement_exists(&self, name: &str) -> bool;
fn find_arrangement_by_name(&self, name: &str) -> Option<ArrangementInfo>;
}
pub trait UpdateOps {
fn check_for_updates(&self) -> UpdateCheckResult;
fn last_check_result(&self) -> Option<UpdateCheckResult>;
fn install_update(&mut self, version: &str) -> anyhow::Result<()>;
fn is_installing(&self) -> bool;
fn installation_status(&self) -> Option<String>;
}
pub trait CoprocessOps {
fn coprocess_count(&self) -> usize;
fn is_running(&self, index: usize) -> bool;
fn get_error(&self, index: usize) -> Option<String>;
fn get_output(&self, index: usize) -> Vec<String>;
fn start(&mut self, index: usize) -> anyhow::Result<()>;
fn stop(&mut self, index: usize) -> anyhow::Result<()>;
fn clear_output(&mut self, index: usize);
}
pub trait ScriptOps {
fn script_count(&self) -> usize;
fn is_running(&self, index: usize) -> bool;
fn get_error(&self, index: usize) -> Option<String>;
fn get_output(&self, index: usize) -> Vec<String>;
fn start(&mut self, index: usize) -> anyhow::Result<()>;
fn stop(&mut self, index: usize) -> anyhow::Result<()>;
fn clear_output(&mut self, index: usize);
fn get_panel(&self, index: usize) -> Option<(String, String)>;
}
pub trait ShaderOps {
fn install_shaders(&mut self, force_overwrite: bool) -> anyhow::Result<InstallResult>;
fn get_available_shaders(&self) -> Vec<String>;
fn get_available_cubemaps(&self) -> Vec<String>;
fn shaders_dir(&self) -> std::path::PathBuf;
}
#[derive(Debug, Clone)]
pub struct InstallResult {
pub installed: usize,
pub skipped: usize,
pub removed: usize,
}
pub trait ShellIntegrationOps {
fn install_integration(&mut self, shell: par_term_config::ShellType) -> anyhow::Result<()>;
fn uninstall_integration(&mut self, shell: par_term_config::ShellType) -> anyhow::Result<()>;
fn is_integration_installed(&self, shell: par_term_config::ShellType) -> bool;
fn integration_script_path(&self, shell: par_term_config::ShellType) -> std::path::PathBuf;
}