//! Configuration constants for the peer system.

use std::time::Duration;

/// Interval between peer ping checks (seconds).
pub const PEER_PING_INTERVAL_SECS: u64 = 20;

/// Minimum idle time before pinging a peer (seconds).
pub const PEER_PING_IDLE_SECS: u64 = 30;

/// Timeout after which a peer is considered stale (seconds).
pub const PEER_STALE_TIMEOUT_SECS: u64 = 90;

/// Size of each download chunk (32 MB).
pub const CHUNK_SIZE: u64 = 32 * 1024 * 1024;

/// Maximum number of retry attempts for failed chunk downloads.
pub const MAX_RETRY_COUNT: usize = 3;

/// Fallback interval for reconciling missed filesystem watcher events (seconds).
pub const LOCAL_GAME_FALLBACK_SCAN_SECS: u64 = 300;

/// TLS certificate for QUIC connections.
pub static CERT_PEM: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../cert.pem"));

/// TLS private key for QUIC connections.
pub static KEY_PEM: &str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/../../key.pem"));

/// Returns the peer stale timeout as a Duration.
#[must_use]
pub fn peer_stale_timeout() -> Duration {
    Duration::from_secs(PEER_STALE_TIMEOUT_SECS)
}
