<?php

namespace LaraBB\User\UI\Web\Handlers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use LaraBB\User\Actions\Admin\EditAction;
use LaraBB\User\UI\Web\Requests\Edit;

/**
 * Class EditHandler
 * @package LaraBB\User\UI\Web\Handlers\Admin
 */
class EditHandler extends Controller
{
    /**
     * EditHandler constructor.
     * @param EditAction $editAction
     * @param Factory $view
     */
    public function __construct(private readonly EditAction $editAction, private readonly Factory $view)
    {
    }


    /**
     * @param Edit $request
     * @return View
     */
    public function __invoke(Edit $request): View
    {
        return $this->view->make('user::admin.create-edit', $this->editAction->run($request));
    }
}
