use thiserror::Error;
use crate::error::LibraryError;
#[derive(Debug, Error)]
pub enum CreateTargetedMessageError {
#[error("The recipient is not a member of the group.")]
RecipientNotFound,
#[error("The group is not in an active state.")]
GroupNotActive,
#[error(transparent)]
LibraryError(#[from] LibraryError),
}
#[derive(Debug, Error)]
pub enum ProcessTargetedMessageError<StorageError> {
#[error("The group ID in the targeted message does not match.")]
GroupIdMismatch,
#[error("The epoch in the targeted message does not match.")]
EpochMismatch,
#[error("The recipient leaf index does not match own leaf index.")]
NotIntendedRecipient,
#[error("The sender's leaf index refers to a blank or missing leaf.")]
SenderNotFound,
#[error("Failed to decrypt sender authentication data.")]
SenderAuthDataDecryptionFailed,
#[error("Malformed sender authentication data.")]
MalformedSenderAuthData,
#[error("Signature verification on targeted message failed.")]
SignatureVerificationFailed,
#[error("Failed to decrypt targeted message content.")]
ContentDecryptionFailed,
#[error("Malformed targeted message content.")]
MalformedContent,
#[error("The group is not in an active state.")]
GroupNotActive,
#[error("Error reading from storage: {0}")]
StorageError(StorageError),
#[error(transparent)]
LibraryError(#[from] LibraryError),
}