// ABOUTME: Athlete profile and statistics models from fitness providers
// ABOUTME: Athlete, Stats, PersonalRecord, and PrMetric definitions
//
// SPDX-License-Identifier: MIT OR Apache-2.0
// Copyright (c) 2025 Pierre Fitness Intelligence
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
/// Represents an athlete/user profile from any provider
///
/// Contains the essential profile information that's commonly available
/// across fitness platforms.
///
/// # Examples
///
/// ```rust
/// use pierre_mcp_server::models::Athlete;
///
/// let athlete = Athlete {
/// id: "12345".into(),
/// username: "runner123".into(),
/// firstname: Some("John".into()),
/// lastname: Some("Doe".into()),
/// profile_picture: Some("https://dgalywyr863hv.cloudfront.net/pictures/athletes/12345678/avatar/medium.jpg".into()),
/// provider: "strava".into(),
/// };
/// ```
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Athlete {
/// Unique identifier for the athlete (provider-specific)
pub id: String,
/// Public username/handle
pub username: String,
/// First name (may not be public on some providers)
#[serde(skip_serializing_if = "Option::is_none")]
pub firstname: Option<String>,
/// Last name (may not be public on some providers)
#[serde(skip_serializing_if = "Option::is_none")]
pub lastname: Option<String>,
/// `URL` to profile picture/avatar
#[serde(skip_serializing_if = "Option::is_none")]
pub profile_picture: Option<String>,
/// Source provider of this athlete data
pub provider: String,
}
/// Aggregated fitness statistics for an athlete
///
/// Contains summarized statistics across all activities for a given time period.
/// Values are typically calculated from the athlete's activity history.
///
/// # Examples
///
/// ```rust
/// use pierre_mcp_server::models::Stats;
///
/// let stats = Stats {
/// total_activities: 150,
/// total_distance: 1500000.0, // 1500 km in meters
/// total_duration: 540000, // 150 hours in seconds
/// total_elevation_gain: 25000.0, // 25km of elevation
/// };
/// ```
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Stats {
/// Total number of recorded activities
pub total_activities: u64,
/// Total distance covered across all activities (meters)
pub total_distance: f64,
/// Total time spent in activities (seconds)
pub total_duration: u64,
/// Total elevation gained across all activities (meters)
pub total_elevation_gain: f64,
}
/// Types of personal record metrics tracked
///
/// Each metric represents a different aspect of athletic performance
/// that can be optimized and tracked over time.
#[non_exhaustive]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
#[serde(rename_all = "snake_case")]
pub enum PrMetric {
/// Fastest pace achieved (seconds per meter)
FastestPace,
/// Longest distance covered in a single activity (meters)
LongestDistance,
/// Highest elevation gained in a single activity (meters)
HighestElevation,
/// Fastest completion time for a standard distance (seconds)
FastestTime,
}
/// Represents a personal record achievement
///
/// Tracks the athlete's best performance in various metrics.
/// Links back to the specific activity where the record was achieved.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PersonalRecord {
/// `ID` of the activity where this record was achieved
pub activity_id: String,
/// Type of performance metric
pub metric: PrMetric,
/// Value of the record (units depend on metric type)
pub value: f64,
/// When the record was achieved
pub date: DateTime<Utc>,
}