use futures_core::future::BoxFuture;
use crate::peer::PeerRef;
use crate::types::{DcOption, PeerId, PeerInfo, UpdateState, UpdatesState};
pub trait Session: Send + Sync {
fn home_dc_id(&self) -> i32;
fn set_home_dc_id(&self, dc_id: i32) -> BoxFuture<'_, ()>;
fn dc_option(&self, dc_id: i32) -> Option<DcOption>;
fn set_dc_option(&self, dc_option: &DcOption) -> BoxFuture<'_, ()>;
fn peer(&self, peer: PeerId) -> BoxFuture<'_, Option<PeerInfo>>;
fn peer_ref(&self, peer: PeerId) -> BoxFuture<'_, Option<PeerRef>> {
Box::pin(async move {
self.peer(peer)
.await
.and_then(|info| info.auth())
.map(|auth| PeerRef { id: peer, auth })
})
}
fn cache_peer(&self, peer: &PeerInfo) -> BoxFuture<'_, ()>;
fn updates_state(&self) -> BoxFuture<'_, UpdatesState>;
fn set_update_state(&self, update: UpdateState) -> BoxFuture<'_, ()>;
}