<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\Question;
use Illuminate\Http\JsonResponse;

class QuestionSolutionController extends Controller
{
    public function __invoke(int $id): JsonResponse
    {
        $question = Question::findOrFail($id);

        return response()->json([
            'id' => $question->id,
            'solution' => $question->solution,
            'answer' => $question->answer,
        ]);
    }
}
