<?php

namespace AutoAdmin\Bundle\Admin\Controller\Admin;

use Composer\InstalledVersions;
use JetBrains\PhpStorm\NoReturn;

class VersionController extends AbstractAdminController
{
    private const FORMAT = 'v1';

    #[NoReturn]
    public function index(): void
    {
        $aaVersion = str_replace('v', '', InstalledVersions::getPrettyVersion('gda/autoadmin'));

        $versions = json_encode([
            'format' => self::FORMAT,
            'version' => $aaVersion,
        ]);

        echo $versions;
        die;
    }
}
