use const_crypto::ed25519;
use solana_program::pubkey::Pubkey;

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

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

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

/// Program id for const pda derivations
const PROGRAM_ID: [u8; 32] = unsafe { *(&crate::id() as *const Pubkey as *const [u8; 32]) };

/// The address of the governance account.
pub const GOVERNANCE_ADDRESS: Pubkey =
    Pubkey::new_from_array(ed25519::derive_program_address(&[GOVERNANCE], &PROGRAM_ID).0);

/// Denominator for percentage calculations (basis points).
pub const DENOMINATOR_BPS: u64 = 10_000;

/// Default minimum proposal deposit (1,000 refined OIL in atomic units).
/// Assuming 11 decimals: 1,000 * 10^11 = 100,000,000,000,000
pub const DEFAULT_MIN_PROPOSAL_DEPOSIT: u64 = 100_000_000_000_000;

/// Default voting period (7 days in seconds).
pub const DEFAULT_VOTING_PERIOD_SECONDS: u64 = 7 * 24 * 60 * 60;

/// Default timelock period (2 days in seconds).
pub const DEFAULT_TIMELOCK_SECONDS: u64 = 2 * 24 * 60 * 60;

/// Default quorum percentage (5% = 500 basis points).
pub const DEFAULT_QUORUM_BPS: u64 = 500;

/// Default threshold for proposals (50% = 5000 basis points).
/// Single threshold for all proposals (simplified from tier system).
pub const DEFAULT_THRESHOLD_BPS: u64 = 5_000;

/// Default minimum stake duration before voting power is granted (7 days = 604800 seconds).
pub const DEFAULT_MIN_STAKE_DURATION_SECONDS: u64 = 7 * 24 * 60 * 60;
