use async_trait::async_trait;
use crate::error::Result;
#[derive(Debug, Clone)]
pub struct Notification {
pub to: String,
pub channel: Channel,
pub kind: NotificationKind,
pub payload: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Channel {
Email,
Sms,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum NotificationKind {
EmailVerification,
PhoneVerification,
PasswordReset,
MagicLink,
LoginOtp,
}
#[async_trait]
pub trait Notifier: Send + Sync + 'static {
async fn send(&self, message: Notification) -> Result<()>;
}
pub struct LogNotifier;
#[async_trait]
impl Notifier for LogNotifier {
async fn send(&self, message: Notification) -> Result<()> {
tracing::info!(
to = %message.to,
channel = ?message.channel,
kind = ?message.kind,
payload = %message.payload,
"identity notification (LogNotifier — not actually delivered)"
);
Ok(())
}
}