use async_trait::async_trait;
use super::{Asset, AssetSelector, Currency, CurrencyISOCode, DataError};
#[async_trait]
pub trait AssetHandler {
async fn insert_asset(&self, asset: &Asset) -> Result<i32, DataError>;
async fn get_asset_id(&self, asset: &Asset) -> Option<i32>;
async fn get_asset_by_id(&self, id: i32) -> Result<Asset, DataError>;
async fn get_asset_by_isin(&self, id: &str) -> Result<Asset, DataError>;
async fn get_all_assets(&self) -> Result<Vec<Asset>, DataError>;
async fn get_asset_list(&self) -> Result<Vec<AssetSelector>, DataError>;
async fn update_asset(&self, asset: &Asset) -> Result<(), DataError>;
async fn delete_asset(&self, id: i32) -> Result<(), DataError>;
async fn get_all_currencies(&self) -> Result<Vec<Currency>, DataError>;
async fn get_currency_list(&self) -> Result<Vec<AssetSelector>, DataError>;
async fn get_or_new_currency(&self, iso_code: CurrencyISOCode) -> Result<Currency, DataError>;
async fn get_or_new_currency_with_digits(
&self,
iso_code: CurrencyISOCode,
rounding_digits: i32,
) -> Result<Currency, DataError>;
}