<?php

namespace App\Http\Controllers\Api\V1\Admin\User;

use App\Models\AdminUser;
use App\Support\ApiResponse;
use Illuminate\Http\JsonResponse;
use App\Http\Controllers\Controller;
use App\Support\AdminAccountScopeGuard;
use App\Support\AdminUserApiPresenter;

/** GET /api/v1/admin/admin-users/{admin_user} */
final class AdminUserShowController extends Controller
{
    public function __invoke(AdminUser $admin_user): JsonResponse
    {
        AdminAccountScopeGuard::assertPlatformAccount($admin_user);

        $admin_user->load('roles');

        return ApiResponse::success(AdminUserApiPresenter::listItem($admin_user));
    }
}
