use std::io;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("Unsafe key or mailbox name")]
UnsafeName,
#[error("Master key unavailable")]
MasterKeyUnavailable,
#[error("Named key not found")]
NamedKeyNotFound,
#[error("Encrypted key malformed")]
BadEncryptedKey,
#[error("Mailbox full")]
MailboxFull,
#[error("Mailbox read-only")]
MailboxReadOnly,
#[error("Mailbox already exists")]
MailboxExists,
#[error("Mailbox has inferiors")]
MailboxHasInferiors,
#[error("Mailbox is not selectable")]
MailboxUnselectable,
#[error("Operation not allowed for INBOX")]
BadOperationOnInbox,
#[error("No such mailbox")]
NxMailbox,
#[error("Message expunged")]
ExpungedMessage,
#[error("Message not addressable by sequence number")]
UnaddressableMessage,
#[error("Non-existent message")]
NxMessage,
#[error("Unsupported/unknown flag")]
NxFlag,
#[error("Gave up atomic insertion after too many retries")]
GaveUpInsertion,
#[error("File/directory layout is corrupt")]
CorruptFileLayout,
#[error("Unsupported special-use for CREATE")]
UnsupportedSpecialUse,
#[error("Rename source and destination are the same")]
RenameToSelf,
#[error("Rename destination is child of self")]
RenameIntoSelf,
#[error("Too many items in batch operation")]
BatchTooBig,
#[error("Unknown Content-Transfer-Encoding")]
UnknownCte,
#[error(transparent)]
Io(#[from] io::Error),
#[error(transparent)]
Nix(#[from] nix::Error),
#[error(transparent)]
Ssl(#[from] openssl::error::ErrorStack),
#[error(transparent)]
Cbor(#[from] serde_cbor::error::Error),
#[error(transparent)]
Toml(#[from] toml::de::Error),
}