<?php

namespace LaraBB\Settings\UI\Web\Handlers\Admin\Prefix;

use Illuminate\Http\RedirectResponse;
use LaraBB\Settings\Actions\Prefix\StoreAction;
use LaraBB\Settings\UI\Web\Requests\Prefix\Store;

/**
 * Class StoreHandler
 * @package LaraBB\Settings\UI\Web\Handlers\Admin\Prefix
 */
class StoreHandler
{
    /**
     * StoreHandler constructor.
     * @param StoreAction $storeAction
     */
    public function __construct(private readonly StoreAction $storeAction)
    {

    }

    /**
     * @param Store $request
     * @return RedirectResponse
     */
    public function __invoke(Store $request): RedirectResponse
    {
        return $this->storeAction->run($request) ? $request->success() : $request->failed();
    }
}
