//! 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 SecurityTokenProgramError {
    /// 1 - Verification program not found
    #[error("Verification program not found")]
    VerificationProgramNotFound = 0x1,
    /// 2 - Not enough accounts for verification
    #[error("Not enough accounts for verification")]
    NotEnoughAccountsForVerification = 0x2,
    /// 3 - Account intersection mismatch
    #[error("Account intersection mismatch")]
    AccountIntersectionMismatch = 0x3,
    /// 4 - Invalid Verification Config PDA
    #[error("Invalid Verification Config PDA")]
    InvalidVerificationConfigPda = 0x4,
    /// 5 - Cannot modify external metadata account
    #[error("Cannot modify external metadata account")]
    CannotModifyExternalMetadataAccount = 0x5,
    /// 6 - Internal metadata storage requires metadata to be provided
    #[error("Internal metadata storage requires metadata to be provided")]
    InternalMetadataRequiresData = 0x6,
    /// 7 - External metadata storage cannot accept metadata data in this instruction
    #[error("External metadata storage cannot accept metadata data in this instruction")]
    ExternalMetadataForbidsData = 0x7,
}

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