<?php

namespace App\Http\Controllers\Player;

use App\FiveM\Contracts\FrameworkAdapter;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;

class LeaderboardController extends Controller
{
    public function index(Request $request, FrameworkAdapter $adapter): Response
    {
        $account = $request->string('account', 'bank')->value();

        return Inertia::render('Player/Leaderboard', [
            'account' => $account,
            'characters' => $adapter->topByMoney($account, 20)->map->toArray(),
        ]);
    }
}
