use async_trait::async_trait;
use log::info;
use serde::Serialize;

use crate::{
    interpret::Interpret,
    modules::helm::chart::HelmChartScore,
    score::{CloneBoxScore, Score, SerializeScore},
    topology::{HelmCommand, Topology},
};

use super::{config::KubePrometheusConfig, kube_prometheus::kube_prometheus_score};

#[derive(Debug, Clone, Serialize)]
pub struct KubePrometheusStackScore {
    pub monitoring_stack: HelmChartScore,
    
}

impl KubePrometheusStackScore {
    pub fn new(monitoring_stack: HelmChartScore) -> Self {
        Self {
            monitoring_stack,
        }
    }
}

impl Default for KubePrometheusStackScore {
    fn default() -> Self {
        let config = KubePrometheusConfig::default();
        let monitoring_stack = kube_prometheus_score(config);
        
        Self {
           monitoring_stack 
        }
    }
}

impl<T: Topology + HelmCommand> Score<T> for KubePrometheusStackScore {
    fn name(&self) -> String {
        format!("MonitoringAlertingStackScore")
    }

    fn create_interpret(&self) -> Box<dyn Interpret<T>> {
        self.monitoring_stack.create_interpret()
    }
}
