//! Protocol USDC bookkeeping (`treasury` PDA). **`BuyTickets`**, **`AdminInstantSettlement`**, and **`ClaimPositionFee`** update these counters; SPL USDC sits in the treasury ATA (**owner = this PDA**).
//!
//! Daily / weekly **winner lists and tier splits are computed off-chain**; **`ExecutorTreasury`** (**`LANE_PAY`**) debits **`daily_jackpot`** / **`weekly_jackpot`** when the executor pays.

use steel::*;

use super::{treasury_pda, StreakAccount};

#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
pub struct Treasury {
    /// **Daily jackpot** accruals (tickets + settlement subsidy); debited via **`ExecutorTreasury`** (**`LANE_PAY`**, daily pool).
    pub daily_jackpot: u64,
    /// **Weekly jackpot** accruals (tickets + hook split); debited via **`ExecutorTreasury`** (**`LANE_PAY`**, weekly pool).
    pub weekly_jackpot: u64,
    pub buyback: u64,
    /// **`InitMarket`** **create** must use **`period == next_market_period`** (**starts `0`** after **`Initialize`**).
    /// After **`AdminInstantSettlement`**: if the market had **no winning stake**, **`next_market_period`** advances here; if **`winning_total > 0`**, it advances only after **`ExecutorTreasury`** **`MARKET_LINE_RELEASE`** (run after **`DISTRIBUTE_MARKET_REWARD`**).
    /// **`PlaceBet`** must use this same **`period`** while the market is **`STATUS_OPEN`**.
    pub next_market_period: u64,
}

impl Treasury {
    pub fn pda() -> (Pubkey, u8) {
        treasury_pda()
    }
}

account!(StreakAccount, Treasury);
