use std::collections::HashMap;
use std::path::PathBuf;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use crate::sandbox::ExecutionResult;
use super::executor::StdinStrategy;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CodeGenRequest {
pub prompt: String,
pub working_dir: PathBuf,
pub target_files: Vec<PathBuf>,
pub system_context: Option<String>,
pub model: Option<String>,
pub options: HashMap<String, String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CodeGenResult {
pub success: bool,
pub execution: ExecutionResult,
pub parsed_output: Option<serde_json::Value>,
pub files_modified: Vec<PathBuf>,
pub adapter_name: String,
}
#[async_trait]
pub trait AiCliAdapter: Send + Sync {
fn name(&self) -> &str;
fn executable(&self) -> &str;
fn build_args(&self, request: &CodeGenRequest) -> Vec<String>;
fn non_interactive_env(&self) -> HashMap<String, String>;
fn stdin_strategy(&self) -> StdinStrategy;
fn parse_output(&self, request: &CodeGenRequest, result: ExecutionResult) -> CodeGenResult;
async fn health_check(&self) -> Result<(), anyhow::Error>;
}