<?php

declare (strict_types=1);
namespace PoP\ComponentModel\Feedback;

use PoP\Root\FeedbackItemProviders\FeedbackItemProviderInterface;
use PoP\Root\Feedback\FeedbackItemResolution as UpstreamFeedbackItemResolution;
/** @internal */
class FeedbackItemResolution extends UpstreamFeedbackItemResolution
{
    /**
     * @phpstan-param class-string<FeedbackItemProviderInterface> $feedbackProviderServiceClass
     * @param array<string|int|float|bool> $messageParams
     * @param array<FeedbackItemResolution|SchemaFeedbackInterface|ObjectResolutionFeedbackInterface> $causes
     * @param array<string,mixed> $extensions
     */
    public function __construct(
        string $feedbackProviderServiceClass,
        string $code,
        array $messageParams = [],
        /**
         * @see https://github.com/graphql/graphql-spec/issues/893
         */
        protected array $causes = [],
        array $extensions = []
    )
    {
        parent::__construct($feedbackProviderServiceClass, $code, $messageParams, $extensions);
    }
    public static function fromUpstreamFeedbackItemResolution(UpstreamFeedbackItemResolution $upstreamFeedbackItemResolution) : self
    {
        return new self($upstreamFeedbackItemResolution->getFeedbackProviderServiceClass(), $upstreamFeedbackItemResolution->getCode(), $upstreamFeedbackItemResolution->getMessageParams(), $upstreamFeedbackItemResolution->getExtensions());
    }
    /**
     * @return array<FeedbackItemResolution|SchemaFeedbackInterface|ObjectResolutionFeedbackInterface>
     */
    public function getCauses() : array
    {
        return $this->causes;
    }
}
