/**
 * Repository Interface: IAchievementRepository
 * 
 * Defines operations for Achievement and UserAchievement entities
 */

import type { Achievement, AchievementCategory } from '../entities/Achievement';
import type { UserAchievement } from '../entities/UserAchievement';

export interface IAchievementRepository {
  // Achievement operations
  findAchievementById(id: string): Promise<Achievement | null>;
  findAllAchievements(): Promise<Achievement[]>;
  findAchievementsByCategory(category: AchievementCategory): Promise<Achievement[]>;
  createAchievement(achievement: Achievement): Promise<Achievement>;
  
  // UserAchievement operations
  findUserAchievementById(id: string): Promise<UserAchievement | null>;
  findUserAchievementsByUserId(userId: string): Promise<UserAchievement[]>;
  findUserAchievementByUserAndAchievement(userId: string, achievementId: string): Promise<UserAchievement | null>;
  hasUserEarnedAchievement(userId: string, achievementId: string): Promise<boolean>;
  createUserAchievement(userAchievement: UserAchievement): Promise<UserAchievement>;
  updateUserAchievement(userAchievement: UserAchievement): Promise<UserAchievement>;
  
  // Stats
  getAchievementLeaderboard(limit: number): Promise<{ userId: string; points: number; count: number }[]>;
  getUserAchievementStats(userId: string): Promise<{ total: number; points: number; byCategory: Record<AchievementCategory, number> }>;
}