<?php

namespace LaraBB\Category\Actions\Admin;

use JetBrains\PhpStorm\ArrayShape;
use LaraBB\Category\Tasks\FindTask as FindCategoryTask;

/**
 * Class OverviewAction
 * @package LaraBB\Category\Actions\Admin
 */
class IndexAction
{
    /**
     * OverviewAction constructor.
     * @param FindCategoryTask $findCategoryTask
     */
    public function __construct(private readonly FindCategoryTask $findCategoryTask)
    {
    }

    /**
     * @return array
     */
    #[ArrayShape([
        'categories' => "array|\Illuminate\Database\Eloquent\Collection",
        'active'     => "string"
    ])]
    public function run()
    {
        return [
            'categories' => $this->findCategoryTask->all(['forums']),
            'active'     => 'forums'
        ];
    }
}
