use serde::Deserialize;
use serde::Serialize;
use crate::query::ExpandQuery;
use crate::Action;
use crate::BoxTryStream;
use crate::EntityTypeRef;
use crate::Expandable;
use crate::FilterQuery;
use crate::ModificationResponse;
use crate::ODataETag;
use crate::ODataId;
use crate::SessionCreateResponse;
use std::error::Error as StdError;
use std::future::Future;
use std::sync::Arc;
pub trait Bmc: Send + Sync {
type Error: StdError + Send + Sync;
fn expand<T: Expandable>(
&self,
id: &ODataId,
query: ExpandQuery,
) -> impl Future<Output = Result<Arc<T>, Self::Error>> + Send;
fn get<T: EntityTypeRef + for<'de> Deserialize<'de> + 'static>(
&self,
id: &ODataId,
) -> impl Future<Output = Result<Arc<T>, Self::Error>> + Send;
fn filter<T: EntityTypeRef + for<'de> Deserialize<'de> + 'static>(
&self,
id: &ODataId,
query: FilterQuery,
) -> impl Future<Output = Result<Arc<T>, Self::Error>> + Send;
fn create<V: Send + Sync + Serialize, R: Send + Sync + for<'de> Deserialize<'de>>(
&self,
id: &ODataId,
query: &V,
) -> impl Future<Output = Result<ModificationResponse<R>, Self::Error>> + Send;
fn create_session<V: Send + Sync + Serialize, R: Send + Sync + for<'de> Deserialize<'de>>(
&self,
id: &ODataId,
query: &V,
) -> impl Future<Output = Result<SessionCreateResponse<R>, Self::Error>> + Send;
fn update<V: Sync + Send + Serialize, R: Send + Sync + Sized + for<'de> Deserialize<'de>>(
&self,
id: &ODataId,
etag: Option<&ODataETag>,
update: &V,
) -> impl Future<Output = Result<ModificationResponse<R>, Self::Error>> + Send;
fn delete<R: EntityTypeRef + for<'de> Deserialize<'de>>(
&self,
id: &ODataId,
) -> impl Future<Output = Result<ModificationResponse<R>, Self::Error>> + Send;
fn action<T: Send + Sync + Serialize, R: Send + Sync + Sized + for<'de> Deserialize<'de>>(
&self,
action: &Action<T, R>,
params: &T,
) -> impl Future<Output = Result<ModificationResponse<R>, Self::Error>> + Send;
fn stream<T: Sized + for<'de> Deserialize<'de> + Send + 'static>(
&self,
uri: &str,
) -> impl Future<Output = Result<BoxTryStream<T, Self::Error>, Self::Error>> + Send;
}