use async_trait::async_trait;
use log::info;

use crate::{modules::application::ApplicationFeature, topology::Topology};

/// ContinuousDelivery in Harmony provides this functionality :
///
/// - **Package** the application
/// - **Push** to an artifact registry
/// - **Deploy** to a testing environment
/// - **Deploy** to a production environment
///
/// It is intended to be used as an application feature passed down to an ApplicationInterpret. For
/// example :
///
/// ```rust,ignore
/// let app = RustApplicationScore {
///     name: "My Rust App".to_string(),
///     features: vec![ContinuousDelivery::default()],
/// };
/// ```
///
/// *Note :*
///
/// By default, the Harmony Opinionated Pipeline is built using these technologies :
///
/// - Gitea Action (executes pipeline steps)
/// - Docker to build an OCI container image
/// - Helm chart to package Kubernetes resources
/// - Harbor as artifact registru
/// - ArgoCD to install/upgrade/rollback/inspect k8s resources
/// - Kubernetes for runtime orchestration
#[derive(Debug, Default, Clone)]
pub struct ContinuousDelivery {}

#[async_trait]
impl<T: Topology + 'static> ApplicationFeature<T> for ContinuousDelivery {
    async fn ensure_installed(&self, _topology: &T) -> Result<(), String> {
        info!("Installing ContinuousDelivery feature");
        todo!()
    }
}
