<?php

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

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

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

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