<?php

declare (strict_types=1);
namespace PoPAPI\API\ObjectModels\SchemaDefinition;

use PoPAPI\API\Schema\TypeKinds;
use PoP\ComponentModel\Schema\SchemaDefinition;
use PoP\ComponentModel\TypeResolvers\EnumType\EnumTypeResolverInterface;
/** @internal */
class EnumTypeSchemaDefinitionProvider extends \PoPAPI\API\ObjectModels\SchemaDefinition\AbstractNamedTypeSchemaDefinitionProvider
{
    public function __construct(protected EnumTypeResolverInterface $enumTypeResolver)
    {
        parent::__construct($enumTypeResolver);
    }
    public function getTypeKind() : string
    {
        return TypeKinds::ENUM;
    }
    /**
     * @return array<string,mixed>
     */
    public function getSchemaDefinition() : array
    {
        $schemaDefinition = parent::getSchemaDefinition();
        $this->addEnumSchemaDefinition($schemaDefinition);
        return $schemaDefinition;
    }
    /**
     * Add the enum values in the schema: arrays of enum name,
     * description, deprecated and deprecation description
     * @param array<string,mixed> $schemaDefinition
     */
    protected final function addEnumSchemaDefinition(array &$schemaDefinition) : void
    {
        $schemaDefinition[SchemaDefinition::ITEMS] = $this->enumTypeResolver->getEnumSchemaDefinition();
    }
}
