use alloc::boxed::Box;
use miden_protocol::Felt;
use miden_protocol::account::AccountId;
use miden_protocol::note::NoteId;
use super::lineage::PswapLineageState;
use crate::store::StoreError;
#[derive(Debug, thiserror::Error)]
pub enum PswapLineageError {
#[error("no PSWAP lineage tracked for order_id {0}")]
NotFound(Felt),
#[error("PSWAP lineage is not active (state = {0:?}); no further rounds expected")]
NotActive(PswapLineageState),
#[error(
"PSWAP creator account {0} is not local; reclaim requires the creator's signing authority"
)]
CreatorNotLocal(AccountId),
#[error("current tip note is missing from the local store; the tracked lineage is out of sync")]
TipMissing,
#[error(
"PSWAP original note {0} is unavailable in the output-note store or lacks recipient details"
)]
OriginalNoteUnavailable(NoteId),
#[error("unknown PSWAP lineage state byte: {0}")]
UnknownState(u8),
#[error("PSWAP store call failed: {0}")]
Store(#[from] StoreError),
}
impl From<PswapLineageError> for crate::ClientError {
fn from(err: PswapLineageError) -> Self {
crate::ClientError::Observer(Box::new(err))
}
}