use bitcoin::OutPoint;
use bp::dbc::{Anchor, AnchorId};
use commit_verify::lnpbp4;
use wallet::onchain::ResolveTx;
use crate::{ContractId, Extension, Genesis, NodeId, Schema, SchemaId, Transition};
pub trait Stash {
type Error: std::error::Error;
type SchemaIterator: Iterator<Item = Schema>;
type GenesisIterator: Iterator<Item = Genesis>;
type AnchorIterator: Iterator<Item = Anchor<lnpbp4::MerkleBlock>>;
type TransitionIterator: Iterator<Item = Transition>;
type ExtensionIterator: Iterator<Item = Extension>;
type NodeIdIterator: Iterator<Item = NodeId>;
fn get_schema(&self, schema_id: SchemaId) -> Result<Schema, Self::Error>;
fn get_genesis(&self, contract_id: ContractId) -> Result<Genesis, Self::Error>;
fn get_transition(&self, node_id: NodeId) -> Result<Transition, Self::Error>;
fn get_extension(&self, node_id: NodeId) -> Result<Extension, Self::Error>;
fn get_anchor(&self, anchor_id: AnchorId) -> Result<Anchor<lnpbp4::MerkleBlock>, Self::Error>;
fn genesis_iter(&self) -> Self::GenesisIterator;
fn anchor_iter(&self) -> Self::AnchorIterator;
fn transition_iter(&self, contract_id: ContractId) -> Self::TransitionIterator;
fn extension_iter(&self, contract_id: ContractId) -> Self::ExtensionIterator;
fn prune(
&mut self,
tx_resolver: &mut impl ResolveTx,
ownership_resolver: impl Fn(OutPoint) -> bool,
) -> Result<usize, Self::Error>;
}