<?php

declare(strict_types=1);

namespace App\Framework\DI\Exceptions;

use App\Framework\Exception\FrameworkException;

final class ParameterResolutionException extends FrameworkException
{
    public function __construct(
        string $paramName,
        string $class,
        array $dependencyChain,
        int $code = 0,
        ?\Throwable $previous = null
    ) {
        parent::__construct(
            message: "Cannot resolve parameter {$paramName} in $class. Dependency chain: " . implode(' -> ', $dependencyChain),
            code: $code,
            previous: $previous,
            context: [
                'paramName' => $paramName,
                'class' => $class,
                'dependencyChain' => $dependencyChain
            ]
        );
    }
}
