use crate::borrow::Cow;
use crate::{Error, EventChannel, OpConfirm, QoS};
use async_trait::async_trait;
use std::sync::{atomic, Arc};
use std::time::Duration;
#[allow(clippy::module_name_repetitions)]
#[async_trait]
pub trait AsyncClient: Send + Sync {
fn take_event_channel(&mut self) -> Option<EventChannel>;
async fn send(
&mut self,
target: &str,
payload: Cow<'async_trait>,
qos: QoS,
) -> Result<OpConfirm, Error>;
async fn zc_send(
&mut self,
target: &str,
header: Cow<'async_trait>,
payload: Cow<'async_trait>,
qos: QoS,
) -> Result<OpConfirm, Error>;
async fn send_broadcast(
&mut self,
target: &str,
payload: Cow<'async_trait>,
qos: QoS,
) -> Result<OpConfirm, Error>;
async fn publish(
&mut self,
topic: &str,
payload: Cow<'async_trait>,
qos: QoS,
) -> Result<OpConfirm, Error>;
#[allow(unused_variables)]
async fn publish_for(
&mut self,
topic: &str,
receiver: &str,
payload: Cow<'async_trait>,
qos: QoS,
) -> Result<OpConfirm, Error> {
Err(Error::not_supported("publish_for"))
}
async fn subscribe(&mut self, topic: &str, qos: QoS) -> Result<OpConfirm, Error>;
async fn unsubscribe(&mut self, topic: &str, qos: QoS) -> Result<OpConfirm, Error>;
async fn subscribe_bulk(&mut self, topics: &[&str], qos: QoS) -> Result<OpConfirm, Error>;
async fn unsubscribe_bulk(&mut self, topics: &[&str], qos: QoS) -> Result<OpConfirm, Error>;
async fn exclude(&mut self, topic: &str, qos: QoS) -> Result<OpConfirm, Error>;
async fn unexclude(&mut self, topic: &str, qos: QoS) -> Result<OpConfirm, Error>;
async fn exclude_bulk(&mut self, topics: &[&str], qos: QoS) -> Result<OpConfirm, Error>;
async fn unexclude_bulk(&mut self, topics: &[&str], qos: QoS) -> Result<OpConfirm, Error>;
async fn ping(&mut self) -> Result<(), Error>;
fn is_connected(&self) -> bool;
fn get_connected_beacon(&self) -> Option<Arc<atomic::AtomicBool>>;
fn get_timeout(&self) -> Option<Duration>;
fn get_name(&self) -> &str;
}