use crate::balance::Balance;
use crate::contacts::Contact;
use crate::error::Result;
use crate::history::{HistoryFilter, TxRecord};
use crate::signing::HybridSignatureBytes;
use crate::wallet::{MpcWallet, WalletId};
use async_trait::async_trait;
use tenzro_types::primitives::{Address, Hash, Nonce};
use tenzro_types::transaction::Transaction;
use tenzro_types::AssetId;
#[async_trait]
pub trait WalletService: Send + Sync {
async fn provision_wallet(&self) -> Result<MpcWallet>;
async fn get_wallet(&self, wallet_id: &WalletId) -> Result<Option<MpcWallet>>;
async fn list_wallets(&self) -> Result<Vec<WalletId>>;
async fn delete_wallet(&self, wallet_id: &WalletId) -> Result<()>;
async fn set_wallet_label(&self, wallet_id: &WalletId, label: String) -> Result<()>;
async fn get_balance(&self, address: &Address, asset: &AssetId) -> Result<Balance>;
async fn available_balance(&self, address: &Address, asset: &AssetId) -> Result<u128>;
async fn sign_transaction(
&self,
wallet_id: &WalletId,
tx: &Transaction,
) -> Result<HybridSignatureBytes>;
async fn sign_data(
&self,
wallet_id: &WalletId,
data: &[u8],
) -> Result<HybridSignatureBytes>;
fn next_nonce(&self, address: &Address) -> Nonce;
fn peek_nonce(&self, address: &Address) -> Nonce;
async fn get_history(&self, address: &Address) -> Result<Vec<TxRecord>>;
async fn get_filtered_history(
&self,
address: &Address,
filter: &HistoryFilter,
) -> Result<Vec<TxRecord>>;
async fn get_transaction(&self, tx_hash: &Hash) -> Result<Option<TxRecord>>;
async fn add_contact(&self, contact: Contact) -> Result<()>;
async fn get_contact(&self, address: &Address) -> Result<Option<Contact>>;
async fn resolve_contact(&self, name: &str) -> Result<Option<Address>>;
async fn supported_assets(&self) -> Vec<AssetId>;
async fn add_asset_support(&self, wallet_id: &WalletId, asset_id: AssetId) -> Result<()>;
async fn remove_asset_support(&self, wallet_id: &WalletId, asset_id: &AssetId) -> Result<()>;
async fn export_wallet_metadata(&self, wallet_id: &WalletId) -> Result<String>;
async fn import_wallet_metadata(&self, metadata: &str) -> Result<WalletId>;
}