use crate::models::{
DateTimeRangeQuery, DateTimeRangeResponse, DemandGroup, PortfolioRecord, ProductGroup,
ValueRecord,
};
pub trait PortfolioRepository<PortfolioData>: super::Repository {
fn get_portfolio_bidder_id(
&self,
portfolio_id: Self::PortfolioId,
) -> impl Future<Output = Result<Option<Self::BidderId>, Self::Error>> + Send;
fn create_portfolio(
&self,
portfolio_id: Self::PortfolioId,
bidder_id: Self::BidderId,
app_data: PortfolioData,
demand_group: DemandGroup<Self::DemandId>,
product_group: ProductGroup<Self::ProductId>,
as_of: Self::DateTime,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn update_portfolio(
&self,
portfolio_id: Self::PortfolioId,
demand_group: Option<DemandGroup<Self::DemandId>>,
product_group: Option<ProductGroup<Self::ProductId>>,
as_of: Self::DateTime,
) -> impl Future<Output = Result<bool, Self::Error>> + Send;
fn get_portfolio(
&self,
portfolio_id: Self::PortfolioId,
as_of: Self::DateTime,
) -> impl Future<
Output = Result<
Option<
PortfolioRecord<
Self::DateTime,
Self::BidderId,
Self::PortfolioId,
Self::DemandId,
Self::ProductId,
PortfolioData,
>,
>,
Self::Error,
>,
> + Send;
fn query_portfolio(
&self,
bidder_ids: &[Self::BidderId],
as_of: Self::DateTime,
) -> impl Future<Output = Result<Vec<Self::PortfolioId>, Self::Error>> + Send;
fn get_portfolio_demand_history(
&self,
portfolio_id: Self::PortfolioId,
query: DateTimeRangeQuery<Self::DateTime>,
limit: usize,
) -> impl Future<
Output = Result<
DateTimeRangeResponse<
ValueRecord<Self::DateTime, DemandGroup<Self::DemandId>>,
Self::DateTime,
>,
Self::Error,
>,
> + Send;
fn get_portfolio_product_history(
&self,
portfolio_id: Self::PortfolioId,
query: DateTimeRangeQuery<Self::DateTime>,
limit: usize,
) -> impl Future<
Output = Result<
DateTimeRangeResponse<
ValueRecord<Self::DateTime, ProductGroup<Self::ProductId>>,
Self::DateTime,
>,
Self::Error,
>,
> + Send;
}