use steel::*;
#[repr(u32)]
#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]
pub enum StreakError {
#[error("Invalid instruction data")]
InvalidInstruction = 0,
#[error("Program already initialized")]
AlreadyInitialized = 1,
#[error("Signer is not authorized for this ix")]
Unauthorized = 2,
#[error("Account does not match expected PDA")]
BadPda = 3,
#[error("Instruction requires an initialized config")]
NotInitialized = 4,
#[error("Arithmetic overflow")]
Overflow = 5,
#[error("Mint mismatch")]
BadMint = 6,
#[error("Treasury balance insufficient")]
InsufficientTreasury = 9,
#[error("Amount must be a whole-ticket multiple")]
BadTicketUnit = 10,
#[error("Market is not in the expected state")]
BadMarketState = 12,
#[error("Betting window is closed or not open yet")]
BettingClosed = 13,
#[error("Trader already has a position for this period")]
DuplicatePosition = 14,
#[error("Position already finalized")]
PositionAlreadyHandled = 15,
#[error("Trader is not on the winning side")]
NotAWinner = 16,
#[error("Cannot subsidize winners when no winning stake")]
EmptyWinningSide = 17,
#[error("Unknown treasury pay pool")]
InvalidTreasuryPayPool = 18,
#[error("Not enough ticket balance for this bet")]
InsufficientTickets = 19,
#[error("Ledger missing; buy tickets first")]
LedgerNotReady = 20,
#[error("Price account owner is not the configured Pyth program")]
PythBadOwner = 21,
#[error("Could not parse Pyth price account")]
PythInvalidAccount = 22,
#[error("Pyth price is stale for the configured max age")]
OraclePriceStale = 23,
#[error("Could not normalize oracle prices for comparison")]
OracleNormalize = 24,
#[error("Oracle open and close prices tie at resolved precision (reserved; ties settle as DOWN)")]
OracleParityTie = 25,
#[error("Market missing open Pyth anchor; rerun InitMarket in the anchor window after open_ts (matching open_ts / close_ts / pyth feed / rules_hash)")]
MarketNotOracleAnchored = 26,
#[error("Pyth feed pubkey must be non-default on Market INIT")]
InvalidPythPriceFeed = 30,
#[error("InitMarket crank before Market::open_ts")]
AnchorTooEarly = 31,
#[error("InitMarket crank after grace window for this bucket")]
AnchorWindowExpired = 32,
#[error("PlaceBet requires InitMarket-open anchor before staking")]
MarketNotAnchoredYet = 33,
#[error("Market open snapshot already recorded (InitMarket crank is idempotent-complete)")]
MarketAlreadyAnchored = 34,
#[error("ExecutorTreasury instruction kind byte is invalid")]
InvalidExecutorTreasuryKind = 35,
#[error("ExecutorTreasury DISTRIBUTE branch requires pool=0 and amount=0")]
InvalidExecutorTreasuryPayload = 36,
#[error("Reserved (legacy sequencing); InitMarket no longer gates create on treasury cursor")]
WrongMarketSequenceForCreate = 37,
#[error("Reserved (legacy sequencing); PlaceBet no longer gates on treasury cursor")]
BetWrongMarketPeriod = 38,
#[error("MARKET_LINE_RELEASE: market not settled or line already advanced")]
MarketLineReleaseInvalid = 39,
#[error("series_id out of range (see MAX_MARKET_SERIES)")]
InvalidMarketSeries = 40,
#[error("Settlement blocked: outstanding pre-open committed stakes (merge via **`PlaceBet`** live **`ticket_units`** **0**, or **`ExecutorTreasury`** **`EXECUTOR_KIND_MERGE_COMMITTED_POSITION`)")]
UnresolvedCommittedStakes = 41,
#[error("Executor merge COMMITTED blocked: requires open oracle and (live window OR market past close_ts, still OPEN)")]
MergeCommittedBlocked = 42,
#[error("PlaceBet ticket_units must be nonzero unless activating a COMMITTED pre-open position in the live window")]
PlaceBetNothingToActivate = 43,
}
error!(StreakError);