use std::collections::HashMap;
use anyhow::Result;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
use crate::template::AgentTemplate;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DeployedService {
pub service_id: String,
pub url: Option<String>,
pub status: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct DeploymentResult {
pub project_id: String,
pub environment_id: String,
pub services: HashMap<String, DeployedService>,
}
#[async_trait]
pub trait DeployBackend: Send + Sync {
async fn deploy(
&self,
project_name: &str,
template: &AgentTemplate,
extra_env: &HashMap<String, String>,
) -> Result<DeploymentResult>;
async fn status(&self, project_id: &str) -> Result<HashMap<String, DeployedService>>;
async fn destroy(&self, project_id: &str) -> Result<()>;
#[allow(dead_code)]
async fn restart(&self, project_id: &str) -> Result<()>;
#[allow(dead_code)]
async fn scale(&self, project_id: &str, service_name: &str, replicas: u32) -> Result<()>;
}