import { NextResponse } from "next/server";
import { userStatsService } from "@/services/users/user-stats.service";

export async function GET() {
  try {
    const leaderboard = await userStatsService.getLeaderboard(10);

    return NextResponse.json(leaderboard);
  } catch (error) {
    console.error("Error fetching leaderboard:", error);
    return NextResponse.json(
      { error: "Erreur lors de la récupération du leaderboard" },
      { status: 500 }
    );
  }
}
