pub mod feishu;

use async_trait::async_trait;

#[derive(Debug)]
pub enum NotificationLevel {
    Critical,
    Warn,
    Notice,
    Debug,
}

#[async_trait]
pub trait Notifier {
    async fn send(&self, level: NotificationLevel, message: &str, module: Option<&str>);
}

impl dyn Notifier + Sync + Send {
    async fn send_critical(&self, message: &str, module: Option<&str>) {
        self.send(NotificationLevel::Critical, message, module)
            .await;
    }

    async fn send_warn(&self, message: &str, module: Option<&str>) {
        self.send(NotificationLevel::Warn, message, module).await;
    }

    async fn send_notice(&self, message: &str, module: Option<&str>) {
        self.send(NotificationLevel::Notice, message, module).await;
    }

    async fn send_debug(&self, message: &str, module: Option<&str>) {
        self.send(NotificationLevel::Debug, message, module).await;
    }
}
