use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Error, Debug)]
pub enum Error {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Invalid BLTE magic: expected [66, 76, 84, 69], got {0:?}")]
InvalidMagic([u8; 4]),
#[error("Invalid header format: {0}")]
InvalidHeader(String),
#[error("Invalid header size: {0}")]
InvalidHeaderSize(u32),
#[error("Invalid chunk count: {0}")]
InvalidChunkCount(u32),
#[error("Unknown compression mode: {0:#04x}")]
UnknownCompressionMode(u8),
#[error("Decompression failed: {0}")]
DecompressionFailed(String),
#[error("Encryption error: {0}")]
Encryption(#[from] ngdp_crypto::CryptoError),
#[error("Key not found: {0:#018x}")]
KeyNotFound(u64),
#[error("Checksum mismatch: expected {expected}, got {actual}")]
ChecksumMismatch { expected: String, actual: String },
#[error("Truncated data: expected {expected} bytes, got {actual}")]
TruncatedData { expected: usize, actual: usize },
#[error("Invalid encrypted block: {0}")]
InvalidEncryptedBlock(String),
#[error("Unsupported encryption type: {0:#04x}")]
UnsupportedEncryptionType(u8),
}