use crate::null::validate_for_send;
use crate::{Channel, Notification, NotifierError, Transport};
#[derive(Clone, Copy, Debug, Default)]
pub struct SmsOnlyTransport;
impl SmsOnlyTransport {
#[must_use]
pub const fn new() -> Self {
Self
}
}
impl Transport for SmsOnlyTransport {
fn supports(&self, channel: Channel) -> bool {
matches!(channel, Channel::Sms)
}
fn send(&self, notification: &Notification) -> Result<(), NotifierError> {
if !self.supports(notification.channel()) {
return Err(NotifierError::UnsupportedChannel {
channel: notification.channel().as_str().to_owned(),
});
}
validate_for_send(notification)
}
}