use anchor_lang::prelude::*;
#[error_code]
pub enum AntegenThreadError {
#[msg("The exec response could not be parsed")]
InvalidThreadResponse,
#[msg("The thread is in an invalid state")]
InvalidThreadState,
#[msg("The trigger variant cannot be changed")]
InvalidTriggerVariant,
#[msg("The provided nonce account is invalid")]
InvalidNonceAccount,
#[msg("The trigger condition has not been activated")]
TriggerConditionFailed,
#[msg("This operation cannot be processed because the thread is currently busy")]
ThreadBusy,
#[msg("The thread is currently paused")]
ThreadPaused,
#[msg("The thread's rate limit has been reached")]
RateLimitExeceeded,
#[msg("Thread rate limits cannot exceed the maximum allowed value")]
MaxRateLimitExceeded,
#[msg("Inner instruction attempted to write to an unauthorized address")]
UnauthorizedWrite,
#[msg("Withdrawing this amount would leave the thread with less than the minimum required SOL for rent exemption")]
WithdrawalTooLarge,
#[msg("Thread IDs are limited to 32 bytes")]
ThreadIdTooLong,
#[msg("InsufficientFunds")]
InsufficientFunds,
#[msg("MathOverflow")]
MathOverflow,
#[msg("Thread does not have a nonce account")]
ThreadHasNoNonceAccount,
#[msg("Thread is currently being observed by observers")]
ThreadBeingObserved,
#[msg("Observer has not claimed this thread")]
ObserverNotClaimed,
#[msg("Invalid thread authority")]
InvalidThreadAuthority,
#[msg("Invalid observer authority")]
InvalidObserverAuthority,
#[msg("Invalid registry admin")]
InvalidRegistryAdmin,
#[msg("Invalid instruction provided to thread_submit")]
InvalidInstruction,
#[msg("Invalid signatory for observer")]
InvalidSignatory,
#[msg("This instruction must be called via CPI")]
MustBeCalledViaCPI,
#[msg("Fiber already claimed by another observer")]
AlreadyClaimed,
#[msg("Wrong fiber index for current execution")]
WrongFiberIndex,
#[msg("Observer priority window is still active")]
ObserverPriorityActive,
#[msg("Trigger is not ready yet")]
TriggerNotReady,
#[msg("Nonce account is required for all threads")]
NonceRequired,
#[msg("Invalid observer account provided")]
InvalidObserverAccount,
#[msg("Invalid config admin")]
InvalidConfigAdmin,
#[msg("Global pause is active")]
GlobalPauseActive,
#[msg("Invalid authority for this operation")]
InvalidAuthority,
#[msg("Invalid fee percentage (must be 0-10000)")]
InvalidFeePercentage,
#[msg("Initial instruction provided but fiber account is missing")]
MissingFiberAccount,
#[msg("Invalid fiber index specified in ThreadResponse")]
InvalidFiberIndex,
#[msg("Thread has fibers that must be deleted before the thread can be deleted")]
ThreadHasFibers,
#[msg("Thread has no fibers to execute")]
ThreadHasNoFibersToExecute,
#[msg("Invalid execution index - fiber not found in thread")]
InvalidExecIndex,
#[msg("Only the last executor or no executor can report errors")]
NotLastExecutor,
#[msg("An error has already been reported for this thread")]
ErrorAlreadyReported,
#[msg("Thread is not sufficiently overdue to report an error")]
ThreadNotSufficientlyOverdue,
#[msg("Payment distribution failed")]
PaymentFailed,
#[msg("Fiber account is required for this execution")]
FiberAccountRequired,
#[msg("Invalid fiber cursor provided")]
InvalidFiberCursor,
#[msg("Invalid fiber account - does not belong to this thread or not in fiber_ids")]
InvalidFiberAccount,
#[msg("Missing fiber accounts - all external fibers must be provided for deletion")]
MissingFiberAccounts,
#[msg("Thread has not signaled close - fiber_signal must be Signal::Close")]
CloseNotSignaled,
#[msg("Chain signal must target the next consecutive fiber")]
InvalidChainTarget,
}
pub use AntegenThreadError as ThreadError;