<?php

namespace LaraBB\Category\Actions\Admin;

use JetBrains\PhpStorm\ArrayShape;
use LaraBB\Category\Tasks\FindTask as FindCategoryTask;
use LaraBB\Category\UI\Web\Requests\Edit;

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

    /**
     * @param Edit $request
     * @return array
     */
    #[ArrayShape([
        'category' => "\LaraBB\Category\Models\Category",
        'active'   => "string"
    ])]
    public function run(Edit $request): array
    {
        return [
            'category' => $this->findCategoryTask->byUuid($request->route('uuid')),
            'active'   => 'forums'
        ];
    }
}
