<?php

declare(strict_types=1);

namespace App\State;

use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
use App\ApiResource\AppVersion;
use Symfony\Component\DependencyInjection\Attribute\Autowire;

final readonly class AppVersionProvider implements ProviderInterface
{
    public function __construct(
        #[Autowire('%app.version%')]
        private string $version,
    ) {}

    public function provide(Operation $operation, array $uriVariables = [], array $context = []): AppVersion
    {
        $dto          = new AppVersion();
        $dto->version = $this->version;

        return $dto;
    }
}
