<?php

declare(strict_types=1);

namespace App\Framework\CommandBus;

/**
 * Kapselt Handler-Information für einen Command
 */

final readonly class CommandHandlerDescriptor
{
    public function __construct(
        public string $class,
        public string $method,
        public string $command,
    ) {
    }

    public static function fromHandlerArray(array $handler): self
    {
        return new self(
            class: $handler['class'],
            method: $handler['method'],
            command: $handler['command'],
        );
    }
}
