<?php
declare (strict_types=1);

namespace App\ApiResources\Enum;

use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\ApiProperty;
use App\ApiResources\ApiResourcesInterface;
use App\State\Provider\Enum\EnumProvider;

/**
 * Classe resource qui contient les champs disponibles lors d'un appel à enum.
 */
#[ApiResource(
    operations: [
        new Get(
            uriTemplate: '/enum/{name}',
            provider: EnumProvider::class
        )
    ]
)]
class Enum implements ApiResourcesInterface
{
    #[ApiProperty(identifier: true)]
    private string $name;

    /** @var list<string> $items */
    private array $items = [];

    public function __construct()
    {
    }

    public function getName(): string
    {
        return $this->name;
    }

    public function setName(string $name): self
    {
        $this->name = $name;
        return $this;
    }

    /**
     * @param list<string> $items
     * @return $this
     */
    public function setItems(array $items): self
    {
        $this->items = $items;
        return $this;
    }

    /**
     * @return list<string>
     */
    public function getItems(): array
    {
        return $this->items;
    }
}