<?php

declare(strict_types=1);

namespace App\Shared\Infrastructure\ApiPlatform\State;

use ApiPlatform\Metadata\Operation;
use ApiPlatform\State\ProviderInterface;
use App\Shared\Infrastructure\ApiPlatform\Resource\AppVersion;
use Symfony\Component\DependencyInjection\Attribute\Autowire;

/**
 * @implements ProviderInterface<object>
 */
class AppVersionProvider implements ProviderInterface
{
    public function __construct(
        #[Autowire(param: 'app.version')]
        private readonly string $appVersion,
    ) {}

    public function provide(Operation $operation, array $uriVariables = [], array $context = []): object
    {
        return new AppVersion($this->appVersion);
    }
}
