<?php

declare(strict_types=1);

namespace App\Framework\Router\Exceptions;

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

final class ParameterResolutionException extends FrameworkException
{
    /**
     * @param string $message
     * @param int $code
     * @param \Throwable $previous
     */
    public function __construct(string $message, int $code = 0, ?\Throwable $previous = null)
    {
        parent::__construct(
            message: $message,
            context: ExceptionContext::forOperation('parameter_resolution', 'Router')
                ->withData([
                    'error_type' => 'parameter_resolution_failed',
                    'previous_error' => $previous?->getMessage(),
                ]),
            code: $code,
            previous: $previous
        );
    }
}
