//! Models module for pickleball player ratings using the Pure ELO rating system (v3.0).
//!
//! # ELO Rating System Overview
//!
//! Version 3.0 switched from Glicko-2 (separate singles/doubles with RD and volatility)
//! to a unified Pure ELO system:
//!
//! - **Unified Rating**: Single ELO rating for both singles and doubles matches
//! - **Simple Formula**: Rating Change = K × (Actual Performance - Expected Performance)
//! - **Fair Scoring**: Based on actual points won, not just match win/loss
//! - **Transparent**: No hidden parameters, completely predictable

/// Represents a player profile with unified ELO rating.
///
/// Version 3.0 features:
/// - One unified ELO rating (both singles and doubles contribute to it)
/// - Clean, transparent rating system
/// - Per-point scoring (not just win/loss)
///
/// # Fields
///
/// * `id` - Unique database identifier
/// * `name` - Player's name (unique identifier)
/// * `email` - Optional email for notifications
/// * `rating` - Unified ELO rating (default: 1500.0)
///
/// # Example
///
/// ```ignore
/// let player = Player {
///     id: 1,
///     name: "Alice".to_string(),
///     email: Some("alice@example.com".to_string()),
///     rating: 1650.0,  // Above average, contributions from both singles and doubles
/// };
/// ```
#[derive(Debug, Clone)]
pub struct Player {
    /// Unique database identifier
    pub id: i64,
    /// Player's display name (unique)
    pub name: String,
    /// Optional email address
    pub email: Option<String>,
    
    /// Unified ELO rating (both singles and doubles)
    /// Starts at 1500.0 for new players
    pub rating: f64,
}
