<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Event\Worker\Contracts;

use PpPhp\Core\Platform\Event\Queue\DeferredEvent;
use PpPhp\Core\Platform\Event\Worker\WorkerResult;
use PpPhp\Core\Platform\Event\Worker\WorkerStatus;

interface WorkerInterface
{
    public function id(): string;
    public function name(): string;
    public function status(): WorkerStatus;
    public function start(): void;
    public function stop(): void;
    public function handle(DeferredEvent $event, ?callable $handler = null): WorkerResult;
    public function heartbeat(): array;
}
