#[derive(Debug, thiserror::Error)]
pub enum SegRootError {
	#[error("No exporting packages reported")]
	NoExportingPackagesReported,
	#[error("No block at given slot")]
	NoBlockAtGivenSlot,
	#[error("Core not exporting")]
	CoreNotExporting,
}

// The composite error type for PolkaJAM tooling.
#[derive(Debug, thiserror::Error)]
pub enum Error {
	#[error("Service not found")]
	ServiceNotFound,
	#[error("Bootstrap service not found")]
	BootstrapServiceNotFound,
	#[error("Code of the Bootstrap service not found")]
	BootstrapServiceCodeNotFound,
	#[error("Bootstrap service has no metadata")]
	InvalidBootstrapMetadata,
	#[error("Unknown command")]
	UnknownCommand,
	#[error("Could not parse hash")]
	CouldNotParseHash,
	#[error("Could not parse auth queue")]
	CouldNotParseAuthQueue,
	#[error("Could not parse pair")]
	CouldNotParsePair,
	#[error("Could not parse array")]
	CouldNotParseArray,
	#[error("Value too large")]
	ValueTooLarge,
	#[error("No pending work item")]
	NoPendingWorkItem,
	#[error("No authorization available")]
	NoAuthorizationAvailable,
	#[error("Segment root parse error: {0}")]
	CouldNotParseSegRoot(#[from] SegRootError),
	#[error("I/O error: {0}")]
	Io(#[from] std::io::Error),
	#[error("Integer parse error: {0}")]
	ParseInt(#[from] std::num::ParseIntError),
	#[error("Hex parse error: {0}")]
	HexParse(#[from] hex::FromHexError),
}
