<?php

namespace LaraBB\Forum\Actions\Admin;

use LaraBB\Forum\Tasks\Forum\FindTask as FindForumTask;
use JetBrains\PhpStorm\ArrayShape;

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

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