<?php

declare(strict_types=1);

namespace App\Framework\CommandBus\Exceptions;

use App\Framework\Exception\ExceptionContext;
use App\Framework\Exception\FrameworkException;

final class NoHandlerFound extends FrameworkException
{
    public static function forCommand(string $commandClass): self
    {
        return new self(
            message: "No handler found for command: $commandClass",
            context: ExceptionContext::forOperation('command_execution', 'CommandBus')
                ->withData(['command_class' => $commandClass])
        );
    }
}
