use std::collections::HashMap;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuthorSummary {
pub name: String,
pub email: String,
pub commit_count: usize,
pub insertions: i64,
pub deletions: i64,
pub files_changed: i64,
pub categories: HashMap<String, usize>,
pub first_commit: String,
pub last_commit: String,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RepositorySummary {
pub name: String,
pub commit_count: usize,
pub author_count: usize,
pub insertions: i64,
pub deletions: i64,
pub top_categories: Vec<(String, usize)>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct WeeklyActivity {
pub week: String,
pub author: String,
pub repository: String,
pub commit_count: usize,
pub insertions: i64,
pub deletions: i64,
pub categories: HashMap<String, usize>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ReportData {
pub generated_at: String,
pub period_start: Option<String>,
pub period_end: Option<String>,
pub authors: Vec<AuthorSummary>,
pub repositories: Vec<RepositorySummary>,
pub weekly_activity: Vec<WeeklyActivity>,
pub total_commits: usize,
pub total_authors: usize,
pub category_breakdown: HashMap<String, usize>,
}
impl ReportData {
pub fn empty(generated_at: String) -> Self {
Self {
generated_at,
period_start: None,
period_end: None,
authors: Vec::new(),
repositories: Vec::new(),
weekly_activity: Vec::new(),
total_commits: 0,
total_authors: 0,
category_breakdown: HashMap::new(),
}
}
}