/**
 * ============================================
 * RANKING TYPES
 * ============================================
 * 
 * Types for leaderboards and rankings
 * shared between frontend and backend
 */

import { AchievementBadge } from './achievement';

// ============================================
// RANKING ENTRY
// ============================================

export interface RankingEntry {
  position: number;
  userId?: string;
  username?: string;
  points: number;
  exercisesCompleted: number;
  streak: number;
  perfectExercises?: number;
  averageScore?: number;
  achievementsUnlocked: number;
  badges?: AchievementBadge[];
}

// ============================================
// GLOBAL RANKING
// ============================================

export interface GlobalRanking {
  global: RankingEntry[];
  byModule: Record<string, RankingEntry[]>;
  myPosition: {
    global: RankingEntry | null;
    byModule: Record<string, RankingEntry | null>;
  };
}

// ============================================
// USER RANKING POSITION
// ============================================

export interface UserRankingPosition {
  global: RankingEntry;
  byModule: {
    moduleId: string;
    moduleName: string;
    position: number;
  }[];
}

// ============================================
// RANKING FILTERS
// ============================================

export interface RankingFilters {
  moduleId?: string;
  timeRange?: 'ALL_TIME' | 'WEEKLY' | 'MONTHLY';
  page?: number;
  limit?: number;
}
