use crate::error::Result;
use crate::types::{
ConnectOptions, ConnectResult, Message, PublishOptions, PublishResult, SubscribeOptions,
};
use crate::QoS;
use std::future::Future;
pub trait MqttClientTrait: Send + Sync {
fn is_connected(&self) -> impl Future<Output = bool> + Send + '_;
fn client_id(&self) -> impl Future<Output = String> + Send + '_;
fn connect<'a>(&'a self, address: &'a str) -> impl Future<Output = Result<()>> + Send + 'a;
fn connect_with_options<'a>(
&'a self,
address: &'a str,
options: ConnectOptions,
) -> impl Future<Output = Result<ConnectResult>> + Send + 'a;
fn disconnect(&self) -> impl Future<Output = Result<()>> + Send + '_;
fn publish<'a>(
&'a self,
topic: impl Into<String> + Send + 'a,
payload: impl Into<Vec<u8>> + Send + 'a,
) -> impl Future<Output = Result<PublishResult>> + Send + 'a;
fn publish_qos<'a>(
&'a self,
topic: impl Into<String> + Send + 'a,
payload: impl Into<Vec<u8>> + Send + 'a,
qos: QoS,
) -> impl Future<Output = Result<PublishResult>> + Send + 'a;
fn publish_with_options<'a>(
&'a self,
topic: impl Into<String> + Send + 'a,
payload: impl Into<Vec<u8>> + Send + 'a,
options: PublishOptions,
) -> impl Future<Output = Result<PublishResult>> + Send + 'a;
fn subscribe<'a, F>(
&'a self,
topic_filter: impl Into<String> + Send + 'a,
callback: F,
) -> impl Future<Output = Result<(u16, QoS)>> + Send + 'a
where
F: Fn(Message) + Send + Sync + 'static;
fn subscribe_with_options<'a, F>(
&'a self,
topic_filter: impl Into<String> + Send + 'a,
options: SubscribeOptions,
callback: F,
) -> impl Future<Output = Result<(u16, QoS)>> + Send + 'a
where
F: Fn(Message) + Send + Sync + 'static;
fn unsubscribe<'a>(
&'a self,
topic_filter: impl Into<String> + Send + 'a,
) -> impl Future<Output = Result<()>> + Send + 'a;
fn subscribe_many<'a, F>(
&'a self,
topics: Vec<(&'a str, QoS)>,
callback: F,
) -> impl Future<Output = Result<Vec<(u16, QoS)>>> + Send + 'a
where
F: Fn(Message) + Send + Sync + 'static + Clone;
fn unsubscribe_many<'a>(
&'a self,
topics: Vec<&'a str>,
) -> impl Future<Output = Result<Vec<(String, Result<()>)>>> + Send + 'a;
fn publish_retain<'a>(
&'a self,
topic: impl Into<String> + Send + 'a,
payload: impl Into<Vec<u8>> + Send + 'a,
) -> impl Future<Output = Result<PublishResult>> + Send + 'a;
fn publish_qos0<'a>(
&'a self,
topic: impl Into<String> + Send + 'a,
payload: impl Into<Vec<u8>> + Send + 'a,
) -> impl Future<Output = Result<PublishResult>> + Send + 'a;
fn publish_qos1<'a>(
&'a self,
topic: impl Into<String> + Send + 'a,
payload: impl Into<Vec<u8>> + Send + 'a,
) -> impl Future<Output = Result<PublishResult>> + Send + 'a;
fn publish_qos2<'a>(
&'a self,
topic: impl Into<String> + Send + 'a,
payload: impl Into<Vec<u8>> + Send + 'a,
) -> impl Future<Output = Result<PublishResult>> + Send + 'a;
fn is_queue_on_disconnect(&self) -> impl Future<Output = bool> + Send + '_;
fn set_queue_on_disconnect(&self, enabled: bool) -> impl Future<Output = ()> + Send + '_;
}