//! On-chain accounts.
//!
//! * `Treasury` — USDC custodian and jackpot counters; one per program.
//! * `User`     — cumulative tickets purchased by a wallet; one per user.

mod treasury;
mod user;

pub use treasury::*;
pub use user::*;

use crate::consts::{TREASURY, USER_TICKET};

use num_enum::{IntoPrimitive, TryFromPrimitive};
use steel::*;

#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, IntoPrimitive, TryFromPrimitive)]
pub enum StreakAccount {
    Treasury = 1,
    User = 2,
}

pub fn treasury_pda() -> (Pubkey, u8) {
    Pubkey::find_program_address(&[TREASURY], &crate::ID)
}

/// One `User` PDA per wallet — seeds: `[USER_TICKET, user_pubkey]`.
pub fn user_pda(user: &Pubkey) -> (Pubkey, u8) {
    Pubkey::find_program_address(&[USER_TICKET, user.as_ref()], &crate::ID)
}
