//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/codama-idl/codama>
//!

use num_derive::FromPrimitive;
use thiserror::Error;

#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum SpherenetValidatorWhitelistProgramError {
    /// 2863311360 - Invalid whitelist account
    #[error("Invalid whitelist account")]
    InvalidWhitelistAccount = 0xAAAAAA00,
    /// 2863311361 - Lamport balance below rent-exempt threshold
    #[error("Lamport balance below rent-exempt threshold")]
    NotRentExempt = 0xAAAAAA01,
    /// 2863311362 - Invalid whitelist entry account
    #[error("Invalid whitelist entry account")]
    InvalidWhitelistEntryAccount = 0xAAAAAA02,
    /// 2863311363 - Account already whitelisted
    #[error("Account already whitelisted")]
    AlreadyWhitelisted = 0xAAAAAA03,
    /// 2863311364 - Account space too small
    #[error("Account space too small")]
    AccountSpaceTooSmall = 0xAAAAAA04,
    /// 2863311365 - Failed to parse whitelist length
    #[error("Failed to parse whitelist length")]
    FailedToParseWhitelistLength = 0xAAAAAA05,
    /// 2863311366 - Failed to parse pubkey
    #[error("Failed to parse pubkey")]
    FailedToParsePubkeyForPresenceCheck = 0xAAAAAA06,
    /// 2863311367 - Failed to parse pubkey
    #[error("Failed to parse pubkey")]
    FailedToParsePubkey = 0xAAAAAA07,
    /// 2863311368 - Invalid vote account owner
    #[error("Invalid vote account owner")]
    InvalidVoteAccountOwner = 0xAAAAAA08,
    /// 2863311369 - Start epoch passed
    #[error("Start epoch passed")]
    StartEpochPassed = 0xAAAAAA09,
    /// 2863311370 - End epoch passed
    #[error("End epoch passed")]
    EndEpochPassed = 0xAAAAAA0A,
    /// 2863311371 - Index out of bounds
    #[error("Index out of bounds")]
    IndexOutOfBounds = 0xAAAAAA0B,
    /// 2863311372 - End epoch not passed
    #[error("End epoch not passed")]
    EndEpochNotPassed = 0xAAAAAA0C,
    /// 2863311373 - Account not whitelisted
    #[error("Account not whitelisted")]
    NotWhitelisted = 0xAAAAAA0D,
    /// 2863311374 - Last validator in whitelist
    #[error("Last validator in whitelist")]
    LastValidator = 0xAAAAAA0E,
    /// 2863311375 - Authority already in power
    #[error("Authority already in power")]
    AuthorityAlreadyInPower = 0xAAAAAA0F,
    /// 2863311376 - Pending authority mismatch
    #[error("Pending authority mismatch")]
    PendingAuthorityMismatch = 0xAAAAAA10,
    /// 2863311377 - Authority transfer not initialized
    #[error("Authority transfer not initialized")]
    AuthorityTransferNotInitialized = 0xAAAAAA11,
    /// 2863311378 - No idea yet
    #[error("No idea yet")]
    NoIdeaYet = 0xAAAAAA12,
    /// 2863311379 - Invalid whitelist entry account
    #[error("Invalid whitelist entry account")]
    InvalidWhitelistEntryAccountOwner = 0xAAAAAA13,
    /// 2863311380 - Start epoch must be smaller than end epoch
    #[error("Start epoch must be smaller than end epoch")]
    StartEpochMustBeSmallerThanEndEpoch = 0xAAAAAA14,
    /// 2863311381 - Authority transfer already initialized. Cancel existing transfer first.
    #[error("Authority transfer already initialized. Cancel existing transfer first.")]
    AuthorityTransferAlreadyInitialized = 0xAAAAAA15,
    /// 2863311382 - Term in progress
    #[error("Term in progress")]
    TermInProgress = 0xAAAAAA16,
    /// 2863311383 - Invalid account data
    #[error("Invalid account data")]
    InvalidAccountData = 0xAAAAAA17,
    /// 2863311384 - Invalid instruction data
    #[error("Invalid instruction data")]
    InvalidInstructionData = 0xAAAAAA18,
    /// 2863311385 - Validator not active
    #[error("Validator not active")]
    ValidatorNotActive = 0xAAAAAA19,
    /// 2863311386 - Validator not removed
    #[error("Validator not removed")]
    ValidatorNotRemoved = 0xAAAAAA1A,
    /// 2863311387 - Invalid whitelist entry account info
    #[error("Invalid whitelist entry account info")]
    InvalidWhitelistEntryAccountInfo = 0xAAAAAA1B,
}

impl From<SpherenetValidatorWhitelistProgramError>
    for solana_program_error::ProgramError
{
    fn from(e: SpherenetValidatorWhitelistProgramError) -> Self {
        solana_program_error::ProgramError::Custom(e as u32)
    }
}
