<?php

namespace LaraBB\Thread\UI\Web\Handlers;

use App\Http\Controllers\Controller;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use LaraBB\Thread\Actions\ShowAction;
use LaraBB\Thread\UI\Web\Requests\Show;

/**
 * Class ShowHandler
 * @package LaraBB\Thread\UI\Web\Handlers
 */
class ShowHandler extends Controller
{
    /**
     * ShowHandler constructor.
     * @param ShowAction $showAction
     * @param Factory $view
     */
    public function __construct(private readonly ShowAction $showAction, private readonly Factory $view)
    {

    }

    /**
     * @param Show $request
     * @return View
     */
    public function __invoke(Show $request): View
    {
        return $this->view->make('thread::show', $this->showAction->run($request));
    }
}
