<?php

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

/** @internal */
class ObjectTypeFieldResolutionFeedbackStore
{
    /** @var ObjectTypeFieldResolutionFeedbackInterface[] */
    private array $errors = [];
    /** @var ObjectTypeFieldResolutionFeedbackInterface[] */
    private array $partialErrors = [];
    /** @var ObjectTypeFieldResolutionFeedbackInterface[] */
    private array $warnings = [];
    /** @var ObjectTypeFieldResolutionFeedbackInterface[] */
    private array $deprecations = [];
    /** @var ObjectTypeFieldResolutionFeedbackInterface[] */
    private array $notices = [];
    /** @var ObjectTypeFieldResolutionFeedbackInterface[] */
    private array $suggestions = [];
    /** @var ObjectTypeFieldResolutionFeedbackInterface[] */
    private array $logs = [];
    /**
     * Fast check for "no feedback at all" — used by callers
     * (notably `resolveValueForObject`) to skip the per-(field,object)
     * `incorporateFromObjectTypeFieldResolutionFeedbackStore` call and
     * its `[$id => new EngineIterationFieldSet([$field])]` allocation
     * on the common path where resolution succeeds without producing
     * any errors/warnings/notices/etc.
     */
    public function isEmpty() : bool
    {
        return $this->errors === [] && $this->partialErrors === [] && $this->warnings === [] && $this->deprecations === [] && $this->notices === [] && $this->suggestions === [] && $this->logs === [];
    }
    /**
     * Clear all collections so the same store can be reused across
     * iterations of `resolveValueForObject`, avoiding per-(field,object)
     * `new ObjectTypeFieldResolutionFeedbackStore()` allocations. Safe
     * because `incorporate*` callers iterate-and-copy (they don't
     * retain references to the source store's internal arrays).
     */
    public function reset() : void
    {
        $this->errors = [];
        $this->partialErrors = [];
        $this->warnings = [];
        $this->deprecations = [];
        $this->notices = [];
        $this->suggestions = [];
        $this->logs = [];
    }
    public function incorporate(\PoP\ComponentModel\Feedback\ObjectTypeFieldResolutionFeedbackStore $objectTypeFieldResolutionFeedbackStore) : void
    {
        $this->errors = \array_merge($this->errors, $objectTypeFieldResolutionFeedbackStore->getErrors());
        $this->partialErrors = \array_merge($this->partialErrors, $objectTypeFieldResolutionFeedbackStore->getPartialErrors());
        $this->warnings = \array_merge($this->warnings, $objectTypeFieldResolutionFeedbackStore->getWarnings());
        $this->deprecations = \array_merge($this->deprecations, $objectTypeFieldResolutionFeedbackStore->getDeprecations());
        $this->notices = \array_merge($this->notices, $objectTypeFieldResolutionFeedbackStore->getNotices());
        $this->suggestions = \array_merge($this->suggestions, $objectTypeFieldResolutionFeedbackStore->getSuggestions());
        $this->logs = \array_merge($this->logs, $objectTypeFieldResolutionFeedbackStore->getLogs());
    }
    public function getErrorCount() : int
    {
        return \count($this->getErrors());
    }
    /**
     * @return ObjectTypeFieldResolutionFeedbackInterface[]
     */
    public function getErrors() : array
    {
        return $this->errors;
    }
    public function addError(\PoP\ComponentModel\Feedback\ObjectTypeFieldResolutionFeedbackInterface $error) : void
    {
        $this->errors[] = $error;
    }
    /**
     * @param ObjectTypeFieldResolutionFeedbackInterface[] $errors
     */
    public function setErrors(array $errors) : void
    {
        $this->errors = $errors;
    }
    public function getPartialErrorCount() : int
    {
        return \count($this->getPartialErrors());
    }
    /**
     * @return ObjectTypeFieldResolutionFeedbackInterface[]
     */
    public function getPartialErrors() : array
    {
        return $this->partialErrors;
    }
    public function addPartialError(\PoP\ComponentModel\Feedback\ObjectTypeFieldResolutionFeedbackInterface $partialError) : void
    {
        $this->partialErrors[] = $partialError;
    }
    /**
     * @param ObjectTypeFieldResolutionFeedbackInterface[] $partialErrors
     */
    public function setPartialErrors(array $partialErrors) : void
    {
        $this->partialErrors = $partialErrors;
    }
    /**
     * @return ObjectTypeFieldResolutionFeedbackInterface[]
     */
    public function getWarnings() : array
    {
        return $this->warnings;
    }
    public function addWarning(\PoP\ComponentModel\Feedback\ObjectTypeFieldResolutionFeedbackInterface $warning) : void
    {
        $this->warnings[] = $warning;
    }
    /**
     * @param ObjectTypeFieldResolutionFeedbackInterface[] $warnings
     */
    public function setWarnings(array $warnings) : void
    {
        $this->warnings = $warnings;
    }
    /**
     * @return ObjectTypeFieldResolutionFeedbackInterface[]
     */
    public function getDeprecations() : array
    {
        return $this->deprecations;
    }
    public function addDeprecation(\PoP\ComponentModel\Feedback\ObjectTypeFieldResolutionFeedbackInterface $deprecation) : void
    {
        $this->deprecations[] = $deprecation;
    }
    /**
     * @param ObjectTypeFieldResolutionFeedbackInterface[] $deprecations
     */
    public function setDeprecations(array $deprecations) : void
    {
        $this->deprecations = $deprecations;
    }
    /**
     * @return ObjectTypeFieldResolutionFeedbackInterface[]
     */
    public function getNotices() : array
    {
        return $this->notices;
    }
    public function addNotice(\PoP\ComponentModel\Feedback\ObjectTypeFieldResolutionFeedbackInterface $notice) : void
    {
        $this->notices[] = $notice;
    }
    /**
     * @param ObjectTypeFieldResolutionFeedbackInterface[] $notices
     */
    public function setNotices(array $notices) : void
    {
        $this->notices = $notices;
    }
    /**
     * @return ObjectTypeFieldResolutionFeedbackInterface[]
     */
    public function getSuggestions() : array
    {
        return $this->suggestions;
    }
    public function addSuggestion(\PoP\ComponentModel\Feedback\ObjectTypeFieldResolutionFeedbackInterface $suggestion) : void
    {
        $this->suggestions[] = $suggestion;
    }
    /**
     * @param ObjectTypeFieldResolutionFeedbackInterface[] $suggestions
     */
    public function setSuggestions(array $suggestions) : void
    {
        $this->suggestions = $suggestions;
    }
    /**
     * @return ObjectTypeFieldResolutionFeedbackInterface[]
     */
    public function getLogs() : array
    {
        return $this->logs;
    }
    public function addLog(\PoP\ComponentModel\Feedback\ObjectTypeFieldResolutionFeedbackInterface $log) : void
    {
        $this->logs[] = $log;
    }
    /**
     * @param ObjectTypeFieldResolutionFeedbackInterface[] $logs
     */
    public function setLogs(array $logs) : void
    {
        $this->logs = $logs;
    }
}
