<?php

namespace LaraBB\Tracker\UI\Web\Handlers;

use Exception;
use LaraBB\Tracker\Actions\AnnounceAction;
use LaraBB\Tracker\UI\Web\Requests\Announce;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

/**
 *
 */
class AnnounceHandler
{
    /**
     * @param AnnounceAction $announceAction
     */
    public function __construct(private readonly AnnounceAction $announceAction)
    {

    }

    /**
     * @param Announce $request
     * @return bool|string
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function __invoke(Announce $request): bool|string
    {
        return $this->announceAction->run($request);
    }
}
