use crate::objects::{BlockScheme, Transaction};
use std::path::PathBuf;
#[allow(clippy::len_without_is_empty)]
pub trait LedgerScheme: Sized {
type Block: BlockScheme;
type Commitment;
type MerkleParameters;
type MerklePath;
type MerkleTreeDigest;
type SerialNumber;
type Transaction: Transaction;
fn new(path: &PathBuf, parameters: Self::MerkleParameters, genesis_block: Self::Block) -> anyhow::Result<Self>;
fn len(&self) -> usize;
fn parameters(&self) -> &Self::MerkleParameters;
fn digest(&self) -> Option<Self::MerkleTreeDigest>;
fn validate_digest(&self, digest: &Self::MerkleTreeDigest) -> bool;
fn contains_cm(&self, cm: &Self::Commitment) -> bool;
fn contains_sn(&self, sn: &Self::SerialNumber) -> bool;
fn contains_memo(&self, memo: &<Self::Transaction as Transaction>::Memorandum) -> bool;
fn prove_cm(&self, cm: &Self::Commitment) -> anyhow::Result<Self::MerklePath>;
fn verify_cm(
parameters: &Self::MerkleParameters,
digest: &Self::MerkleTreeDigest,
cm: &Self::Commitment,
witness: &Self::MerklePath,
) -> bool;
}