use async_trait::async_trait;
use serde_json::Value;
use url::Url;

use crate::{
    interpret::{InterpretError, Outcome},
    topology::K8sAnywhereTopology,
};

#[derive(Debug, Clone)]
pub struct DiscordWebhookConfig {
    pub webhook_url: Url,
    pub name: String,
    pub send_resolved_notifications: bool,
}

pub trait DiscordWebhookReceiver {
    fn deploy_discord_webhook_receiver(
        &self,
        _notification_adapter_id: &str,
    ) -> Result<Outcome, InterpretError>;

    fn delete_discord_webhook_receiver(
        &self,
        _notification_adapter_id: &str,
    ) -> Result<Outcome, InterpretError>;
}

// trait used to generate alert manager config values impl<T: Topology + AlertManagerConfig> Monitor for KubePrometheus
pub trait AlertManagerConfig<T> {
    fn get_alert_manager_config(&self) -> Result<Value, InterpretError>;
}

#[async_trait]
impl<T: DiscordWebhookReceiver> AlertManagerConfig<T> for DiscordWebhookConfig {
    fn get_alert_manager_config(&self) -> Result<Value, InterpretError> {
        todo!()
    }
}

#[async_trait]
impl DiscordWebhookReceiver for K8sAnywhereTopology {
    fn deploy_discord_webhook_receiver(
        &self,
        _notification_adapter_id: &str,
    ) -> Result<Outcome, InterpretError> {
        todo!()
    }
    fn delete_discord_webhook_receiver(
        &self,
        _notification_adapter_id: &str,
    ) -> Result<Outcome, InterpretError> {
        todo!()
    }
}
