use solana_program::{pubkey, pubkey::Pubkey};

/// The authority allowed to invoke [`Initialize`](crate::instruction::Initialize). Replace with your deploy multisig / key before mainnet.
pub const ADMIN_ADDRESS: Pubkey = pubkey!("6asgn8Vq8KKSQx4wm5zVfEfB76wqGVpEpWxajGkbQ8yr");

/// Must sign executor-gated instructions: [`InitMarket`](crate::instruction::InitMarket), [`AdminInstantSettlement`](crate::instruction::AdminInstantSettlement), [`ExecutorTreasury`](crate::instruction::ExecutorTreasury), [`ClaimPositionFee`](crate::instruction::ClaimPositionFee). Replace before production.
pub const EXECUTOR_ADDRESS: Pubkey =
    pubkey!("3B1WXgrV68V6ayymC7C8eVoCMeqeJLR7HWXkxfQxLUeF");

/// Meteora DAMM **cp\_amm** program ID (CPI `claim_position_fee`; local tree `damm-v2/programs/cp-amm`).
pub const CP_AMM_PROGRAM_ID: Pubkey =
    pubkey!("cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG");

/// Basis points denominator (100%).
pub const MAX_BPS: u16 = 10_000;

/// Smallest SPL USDC increment: 10^-6 USD per base unit; ticket purchases and market stakes use whole multiples (1 whole USDC = `TICKET_MICROS` units).
pub const TICKET_MICROS: u64 = 1_000_000;

/// The seed of the ledger account PDA.
pub const LEDGER: &[u8] = b"ledger";

/// PDA seed for **[`crate::state::Market`]**.
pub const MARKET: &[u8] = b"market";

/// PDA seed for **[`crate::state::Position`]** (`POSITION + period LE + trader`).
pub const POSITION: &[u8] = b"position";

/// The seed of the program treasury PDA (owns the protocol USDC ATA).
pub const TREASURY: &[u8] = b"treasury";

/// **`ExecutorTreasury`** (**`LANE_PAY`** **`pool`**): debit [`crate::state::Treasury::daily_jackpot`].
pub const EXECUTOR_PAY_DAILY_JACKPOT: u8 = 0;

/// **`ExecutorTreasury`** (**`LANE_PAY`** **`pool`**): debit [`crate::state::Treasury::weekly_jackpot`].
pub const EXECUTOR_PAY_WEEKLY_JACKPOT: u8 = 1;

/// Ticket revenue split to daily pool (`MAX_BPS` scale).
pub const TICKET_DAILY_BPS: u16 = 7000;

/// Ticket revenue split to weekly pool (`MAX_BPS` scale).
pub const TICKET_WEEKLY_BPS: u16 = 1500;

/// Ticket revenue split to buyback reserve (`MAX_BPS` scale).
pub const TICKET_BUYBACK_BPS: u16 = 1000;

/// Ticket revenue split to team (`MAX_BPS` scale).
pub const TICKET_TEAM_BPS: u16 = 500;

/// Hook fee routed to weekly pool (`MAX_BPS` scale).
pub const HOOK_WEEKLY_BPS: u16 = 4000;

/// Hook fee accrued to treasury reserve lane (`MAX_BPS` scale).
pub const HOOK_RESERVE_BPS: u16 = 3000;

/// Hook fee to buyback (`MAX_BPS` scale).
pub const HOOK_BUYBACK_BPS: u16 = 1000;

/// Hook fee to team (`MAX_BPS` scale).
pub const HOOK_TEAM_BPS: u16 = 2000;

/// Prize-side routing to daily (`MAX_BPS` scale).
pub const PRIZE_DAILY_BPS: u16 = 7000;

/// Prize-side reserve routed into treasury weekly (`MAX_BPS` scale).
pub const PRIZE_RESERVE_BPS: u16 = 2000;

/// Prize-side weekly share (`MAX_BPS` scale).
pub const PRIZE_WEEKLY_BPS: u16 = 1000;

/// SPL USDC mint on Solana **mainnet-beta** (Circle). Token accounts in ix must use this mint (`Initialize` is implicit via consts).
/// EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v - mainnet
pub const USDC_MAINNET_MINT: Pubkey = pubkey!("GAmHPNMcgh9BTpe3DWirqMwvYCeDskE2im6fUhZyukJp");

/// Pyth **legacy** program that owns on-chain price accounts (Solana mainnet-beta). Use the program that owns your feed on devnet/local.
///
/// Pyth also deploys a receiver program for pull feeds; this program uses the classic **`pyth-sdk-solana`** price account layout.
pub const PYTH_ORACLE_PROGRAM: Pubkey = pubkey!("FsJ3A3u2jn5LyT8gHjfPPaoebEJR4WYJtQ8Zpb5EYmEq");

/// Maximum age in seconds (vs `Clock::unix_timestamp`) for Pyth aggregate freshness in **`get_price_no_older_than`**.
pub const PYTH_MAX_PRICE_AGE_SECS: u64 = 600;

/// **`InitMarket`** (**open-anchor** crank / tail of **`create`**): **`Clock::unix_timestamp`** must satisfy **`∈ [open_ts, min(open_ts + this constant, close_ts))`** so the open tick aligns with bucket start (fixed-bucket oracle anchor).
pub const MARKET_OPEN_ANCHOR_GRACE_SECS: i64 = 60;

/// SPL USDC recipient for team-fee legs: **`ticket_team_bps`** (`BuyTickets`), **`hook_team_bps`** (`ClaimPositionFee`).
pub const FEE_COLLECTOR: Pubkey = pubkey!("FEeB92JDVmVuuoaoTjKyfDPPrLTWPGg2EJTrY3TmTx3T");
