use serde::Serialize;

use crate::{
    score::Score,
    topology::{Topology, Url},
};

use super::{ApplicationFeature, ApplicationInterpret, features::ContinuousDelivery};

#[derive(Debug, Serialize, Clone)]
pub struct RustWebappScore<T: Topology + Clone + Serialize> {
    pub name: String,
    pub domain: Url,
    pub features: Vec<Box<dyn ApplicationFeature<T>>>,
}

impl<T: Topology + std::fmt::Debug + Clone + Serialize + 'static> Score<T> for RustWebappScore<T> {
    fn create_interpret(&self) -> Box<dyn crate::interpret::Interpret<T>> {
        Box::new(ApplicationInterpret {
            features: self.features.clone(),
        })
    }

    fn name(&self) -> String {
        format!("{}-RustWebapp", self.name)
    }
}
