use crate::models::{
DateTimeRangeQuery, DateTimeRangeResponse, DemandCurve, DemandRecord, ValueRecord,
};
pub trait DemandRepository<DemandData>: super::Repository {
fn get_demand_bidder_id(
&self,
demand_id: Self::DemandId,
) -> impl Future<Output = Result<Option<Self::BidderId>, Self::Error>> + Send;
fn create_demand(
&self,
demand_id: Self::DemandId,
bidder_id: Self::BidderId,
app_data: DemandData,
curve_data: Option<DemandCurve>,
as_of: Self::DateTime,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn update_demand(
&self,
demand_id: Self::DemandId,
curve_data: Option<DemandCurve>,
as_of: Self::DateTime,
) -> impl Future<Output = Result<bool, Self::Error>> + Send;
fn get_demand(
&self,
demand_id: Self::DemandId,
as_of: Self::DateTime,
) -> impl Future<
Output = Result<
Option<
DemandRecord<
Self::DateTime,
Self::BidderId,
Self::DemandId,
Self::PortfolioId,
DemandData,
>,
>,
Self::Error,
>,
> + Send;
fn query_demand(
&self,
bidder_ids: &[Self::BidderId],
as_of: Self::DateTime,
) -> impl Future<Output = Result<Vec<Self::DemandId>, Self::Error>> + Send;
fn get_demand_history(
&self,
demand_id: Self::DemandId,
query: DateTimeRangeQuery<Self::DateTime>,
limit: usize,
) -> impl Future<
Output = Result<
DateTimeRangeResponse<ValueRecord<Self::DateTime, DemandCurve>, Self::DateTime>,
Self::Error,
>,
> + Send;
}