<?php

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

use App\Support\ApiResponse;
use App\Models\PlayConfigVersion;
use Illuminate\Http\JsonResponse;
use App\Http\Controllers\Controller;
use App\Support\AdminConfigPresenter;

/** GET /api/v1/admin/config/play-versions/{id} */
final class PlayConfigVersionShowController extends Controller
{
    public function __invoke(int $id): JsonResponse
    {
        /** @var PlayConfigVersion $v */
        $v = PlayConfigVersion::query()->with('items')->whereKey($id)->firstOrFail();

        return ApiResponse::success(AdminConfigPresenter::playConfigVersionDetail($v));
    }
}
