use async_trait::async_trait;
use thiserror::Error;
pub mod fcm;
#[derive(Error, Debug)]
pub enum PushError {
#[error("Token is no longer registered")]
Unregistered,
#[error("Rate limit exceeded")]
QuotaExceeded,
#[error("External service error: {0}")]
Other(#[from] anyhow::Error),
}
#[async_trait]
pub trait PushProvider: Send + Sync + std::fmt::Debug {
async fn send_push(&self, token: &str) -> Result<(), PushError>;
}
#[derive(Debug)]
pub struct LoggingPushProvider;
#[async_trait]
impl PushProvider for LoggingPushProvider {
async fn send_push(&self, _token: &str) -> Result<(), PushError> {
tracing::warn!("Push notification not sent: FCM is not configured");
Ok(())
}
}