use std::fmt::Debug;
use std::future::Future;
use std::path::PathBuf;
use super::error::CodingError;
use super::tools::ast_grep::{AstGrepInput, AstGrepOutput, perform_ast_grep};
use super::tools::bash::{BackgroundProcessHandle, BashInput, BashResult, ReadBackgroundBashOutput};
use super::tools::edit_file::{EditFileArgs, EditFileResponse};
use super::tools::find::{FindInput, FindOutput, find_files};
use super::tools::grep::{GrepInput, GrepOutput, perform_grep};
use super::tools::list_files::{ListFilesArgs, ListFilesResult};
use super::tools::read_file::{ReadFileArgs, ReadFileResult};
use super::tools::write_file::{WriteFileArgs, WriteFileResponse};
#[doc = include_str!("../docs/coding_tools.md")]
pub trait CodingTools: Send + Sync + Debug {
fn read_file(&self, args: ReadFileArgs) -> impl Future<Output = Result<ReadFileResult, CodingError>> + Send;
fn write_file(&self, args: WriteFileArgs) -> impl Future<Output = Result<WriteFileResponse, CodingError>> + Send;
fn edit_file(&self, args: EditFileArgs) -> impl Future<Output = Result<EditFileResponse, CodingError>> + Send;
fn list_files(&self, args: ListFilesArgs) -> impl Future<Output = Result<ListFilesResult, CodingError>> + Send;
fn bash(
&self,
args: BashInput,
cwd: Option<PathBuf>,
) -> impl Future<Output = Result<BashResult, CodingError>> + Send;
fn read_background_bash(
&self,
handle: BackgroundProcessHandle,
filter: Option<String>,
) -> impl Future<Output = Result<(ReadBackgroundBashOutput, Option<BackgroundProcessHandle>), CodingError>> + Send;
fn grep(&self, args: GrepInput) -> impl Future<Output = Result<GrepOutput, CodingError>> + Send {
async move { perform_grep(args).await.map_err(CodingError::from) }
}
fn ast_grep(&self, args: AstGrepInput) -> impl Future<Output = Result<AstGrepOutput, CodingError>> + Send {
async move { perform_ast_grep(args).await.map_err(CodingError::from) }
}
fn find(&self, args: FindInput) -> impl Future<Output = Result<FindOutput, CodingError>> + Send {
async move { find_files(args).await.map_err(CodingError::from) }
}
}