<?php

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

use App\Http\Controllers\Controller;
use Illuminate\Contracts\View\View;
use Illuminate\View\Factory;
use LaraBB\Group\Actions\Admin\OverviewAction;

/**
 * Class OverviewHandler
 * @package LaraBB\User\UI\Web\Handlers\Admin
 */
class OverviewHandler extends Controller
{
    /**
     * @param OverviewAction $overviewAction
     * @param Factory $view
     */
    public function __construct(private readonly OverviewAction $overviewAction, private readonly Factory $view)
    {
    }

    /**
     * @return View
     */
    public function __invoke(): View
    {
        $return = $this->overviewAction->run();

        return $this->view->make('group::admin.index', [
            'groups' => $return,
            'active' => 'groups'
        ]);
    }
}
