//! 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 WavebreakError {
    /// 6000 - Invalid account role
    #[error("Invalid account role")]
    InvalidAccountRole = 0x1770,
    /// 6001 - Incorrect account address
    #[error("Incorrect account address")]
    IncorrectAccountAddress = 0x1771,
    /// 6002 - Permission still active
    #[error("Permission still active")]
    PermissionActive = 0x1772,
    /// 6003 - Permission expired
    #[error("Permission expired")]
    PermissionExpired = 0x1773,
    /// 6004 - Permission invalid signature
    #[error("Permission invalid signature")]
    PermissionInvalidSignature = 0x1774,
    /// 6005 - Error from whirlpool lib
    #[error("Error from whirlpool lib")]
    WhirlpoolError = 0x1775,
    /// 6006 - Unknown instruction discriminator
    #[error("Unknown instruction discriminator")]
    UnknownInstructionDiscriminator = 0x1776,
    /// 6007 - Incorrect program id
    #[error("Incorrect program id")]
    IncorrectProgramId = 0x1777,
    /// 6008 - Not enough account keys
    #[error("Not enough account keys")]
    NotEnoughAccountKeys = 0x1778,
    /// 6009 - Arithmetic error
    #[error("Arithmetic error")]
    ArithmeticError = 0x1779,
    /// 6010 - Error calculating quote from math-lib
    #[error("Error calculating quote from math-lib")]
    QuoteError = 0x177A,
    /// 6011 - Slippage exceeded
    #[error("Slippage exceeded")]
    SlippageExceeded = 0x177B,
    /// 6012 - Error calculating token price
    #[error("Error calculating token price")]
    PriceError = 0x177C,
    /// 6013 - Token has not met graduation conditions
    #[error("Token has not met graduation conditions")]
    GraduationConditionsNotMet = 0x177D,
    /// 6014 - Whirlpool already exists
    #[error("Whirlpool already exists")]
    WhirlpoolAlreadyExists = 0x177E,
    /// 6015 - Incorrect graduation instruction
    #[error("Incorrect graduation instruction")]
    IncorrectGraduationInstruction = 0x177F,
    /// 6016 - Bonding curve is still active
    #[error("Bonding curve is still active")]
    BondingCurveNotExpired = 0x1780,
    /// 6017 - Insufficient tokens for graduation
    #[error("Insufficient tokens for graduation")]
    InsufficientTokensForGraduation = 0x1781,
    /// 6018 - Missing permission consume instruction
    #[error("Missing permission consume instruction")]
    MissingPermissionConsumeInstruction = 0x1782,
    /// 6019 - Bonding curve is either not launched yet or is ready to be graduated
    #[error("Bonding curve is either not launched yet or is ready to be graduated")]
    BondingCurveNotActive = 0x1783,
    /// 6020 - Invalid price curve
    #[error("Invalid price curve")]
    InvalidPriceCurve = 0x1784,
    /// 6021 - Graduation method not called
    #[error("Graduation method not called")]
    GraduationMethodNotCalled = 0x1785,
    /// 6022 - Invalid account data
    #[error("Invalid account data")]
    InvalidAccountData = 0x1786,
    /// 6023 - Invalid seeds
    #[error("Invalid seeds")]
    InvalidSeeds = 0x1787,
    /// 6024 - Account is not owned by the right program
    #[error("Account is not owned by the right program")]
    IncorrectOwner = 0x1788,
    /// 6025 - Invalid instruction data
    #[error("Invalid instruction data")]
    InvalidInstructionData = 0x1789,
    /// 6027 - An account does not have the required privileges
    #[error("An account does not have the required privileges")]
    MissingPrivileges = 0x178B,
    /// 6028 - No more authority slots
    #[error("No more authority slots")]
    NoMoreAuthoritySlots = 0x178C,
    /// 6029 - Event serialization failed
    #[error("Event serialization failed")]
    EmitEventError = 0x178D,
}

impl solana_program_error::PrintProgramError for WavebreakError {
    fn print<E>(&self) {
        solana_msg::msg!(&self.to_string());
    }
}

impl<T> solana_decode_error::DecodeError<T> for WavebreakError {
    fn type_of() -> &'static str {
        "WavebreakError"
    }
}
