<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;

class ProfileController extends Controller
{
    public function show()
    {
        $user = auth()->user();
        $div  = getDivision($user->elo);

        return response()->json([
            'id'          => $user->id,
            'discord_id'  => $user->discord_id,
            'username'    => $user->username,
            'avatar'      => $user->avatar,
            'elo'         => $user->elo,
            'rank'        => $user->rank,
            'division'    => $div['name'],
            'wins'        => $user->wins,
            'losses'      => $user->losses,
            'draws'       => $user->draws,
            'win_rate'    => $user->win_rate,
        ]);
    }
}
