<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;

class LeaderboardController extends Controller
{
    public function index(Request $request)
    {
        $players = User::where('is_banned', false)
            ->orderByDesc('elo')
            ->take(100)
            ->get(['id', 'username', 'avatar', 'elo', 'rank', 'wins', 'losses', 'draws', 'current_streak']);

        return response()->json($players);
    }
}
