use crate::types::{snapshot::SnapshotKind, Error as TypesError};
use bee_message::milestone::MilestoneIndex;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),
#[error("types error: {0}")]
Types(#[from] TypesError),
#[error("unexpected snapshot kind: expected {0:?}, read {1:?}")]
UnexpectedSnapshotKind(SnapshotKind, SnapshotKind),
#[error("downloading failed")]
DownloadingFailed,
#[error("no snapshot download source available")]
NoDownloadSourceAvailable,
#[error("invalid file path: {0}")]
InvalidFilePath(String),
#[error("network id mismatch between configuration and snapshot: {0} != {1}")]
NetworkIdMismatch(u64, u64),
#[error("inconsistency between ledger index {0} and sep index {1}")]
LedgerSepIndexesInconsistency(MilestoneIndex, MilestoneIndex),
#[error("invalid milestone diffs count: expected {0}, read {1}")]
InvalidMilestoneDiffsCount(usize, usize),
#[error(
"only a delta snapshot file exists without a full snapshot file (remove the delta snapshot file and restart)"
)]
OnlyDeltaSnapshotFileExists,
#[error("unexpected milestone diff index: {0:?}")]
UnexpectedMilestoneDiffIndex(MilestoneIndex),
#[error("missing consumed treasury")]
MissingConsumedTreasury,
#[error("remaining bytes in file")]
RemainingBytes,
}