use crate::{RegistrationEntry, VerificationKeyForConcatenation};
#[cfg(feature = "future_snark")]
use crate::VerificationKeyForSnark;
#[derive(Debug, Clone, thiserror::Error, PartialEq, Eq)]
pub enum RegisterError {
#[error("This key has already been registered.")]
EntryAlreadyRegistered(Box<RegistrationEntry>),
#[error("Cannot register if the registration is closed.")]
RegistrationClosed,
#[error("Registration is not closed. Cannot create a signer")]
RegistrationIsNotClosed,
#[error("The verification of correctness of the supplied concatenation key is invalid.")]
ConcatenationKeyInvalid(Box<VerificationKeyForConcatenation>),
#[cfg(feature = "future_snark")]
#[error("The verification of correctness of the supplied SNARK key is invalid.")]
SnarkKeyInvalid(Box<VerificationKeyForSnark>),
#[error("Serialization error")]
SerializationError,
#[error("Initializer not registered. Cannot participate as a signer.")]
UnregisteredInitializer,
#[error("No registration found for the given index.")]
UnregisteredIndex,
#[cfg(feature = "future_snark")]
#[error("Unable to create SNARK proof signer.")]
SnarkProofSignerCreation,
#[error("Total stake overflow accumulated stake: {accumulated_stake}, adding stake: {stake}")]
TotalStakeOverflow { accumulated_stake: u64, stake: u64 },
#[error("Cannot run the protocol if total stake is zero.")]
ZeroTotalStake,
}