<?php

declare(strict_types=1);

namespace PackageVersions;

use Composer\InstalledVersions;
use OutOfBoundsException;

class_exists(InstalledVersions::class);

/**
 * This class is generated by composer/package-versions-deprecated, specifically by
 * @see \PackageVersions\Installer
 *
 * This file is overwritten at every run of `composer install` or `composer update`.
 *
 * @deprecated in favor of the Composer\InstalledVersions class provided by Composer 2. Require composer-runtime-api:^2 to ensure it is present.
 */
final class Versions
{
    /**
     * @deprecated please use {@see self::rootPackageName()} instead.
     *             This constant will be removed in version 2.0.0.
     */
    const ROOT_PACKAGE_NAME = 'fusio/fusio';

    /**
     * Array of all available composer packages.
     * Dont read this array from your calling code, but use the \PackageVersions\Versions::getVersion() method instead.
     *
     * @var array<string, string>
     * @internal
     */
    const VERSIONS          = array (
  'brick/math' => '0.10.1@de846578401f4e58f911b3afeb62ced56365ed87',
  'composer/package-versions-deprecated' => '1.11.99.5@b4f54f74ef3453349c24a845d22392cd31e65f1d',
  'doctrine/cache' => '2.2.0@1ca8f21980e770095a31456042471a57bc4c68fb',
  'doctrine/dbal' => '2.13.9@c480849ca3ad6706a39c970cdfe6888fa8a058b8',
  'doctrine/deprecations' => 'v1.0.0@0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de',
  'doctrine/event-manager' => '1.1.2@eb2ecf80e3093e8f3c2769ac838e27d8ede8e683',
  'doctrine/lexer' => '1.2.3@c268e882d4dbdd85e36e4ad69e02dc284f89d229',
  'doctrine/migrations' => '2.3.5@28d92a34348fee5daeb80879e56461b2e862fc05',
  'dragonmantank/cron-expression' => 'v3.3.1@be85b3f05b46c39bbc0d95f6c071ddff669510fa',
  'egulias/email-validator' => '3.2.1@f88dcf4b14af14a98ad96b14b2b317969eab6715',
  'firebase/php-jwt' => 'v5.5.1@83b609028194aa042ea33b5af2d41a7427de80e6',
  'friendsofphp/proxy-manager-lts' => 'v1.0.12@8419f0158715b30d4b99a5bd37c6a39671994ad7',
  'fusio/adapter-cli' => 'v5.0.0@b80522a8d0e957c58bdd25a8b60e0b2dbd02578e',
  'fusio/adapter-fcgi' => 'v5.0.0@40276f9946192158dd4580e6e1de7cdfe26b4cae',
  'fusio/adapter-file' => 'v5.1.0@c169bc524debfdaa09e608d87e5d367e0912371d',
  'fusio/adapter-graphql' => 'v5.0.2@9ca0482f69abfba18398a8178122a66ba976142a',
  'fusio/adapter-http' => 'v5.0.5@4d5fc98840667e04628871405f26f57e2bf906d8',
  'fusio/adapter-php' => 'v5.0.1@1ab83ac4d373467541ddfb3d87dda39930234e33',
  'fusio/adapter-smtp' => 'v5.0.1@b7a6f98c6ad308c91c1fec21936625df833bd4ce',
  'fusio/adapter-soap' => 'v5.0.0@13b8e4ba83872af4b00dff9f4b6a840d7d4b40f1',
  'fusio/adapter-sql' => 'v5.1.8@ef4411daa27d7fe27fd613d2fd2a4ec2aad70041',
  'fusio/adapter-util' => 'v5.1.0@2a7b4451b7474c6b792f78935623fcea3cb8d3da',
  'fusio/cli' => 'v1.0.0@1f72ffbf9835b067c792932f38e222c190b4f635',
  'fusio/engine' => 'v5.2.4@4b366a6c5d06724c21f0bdf4dd0062d1d0a1aa6c',
  'fusio/impl' => 'v6.2.6@80d15f21149fa3d453507edb56e2313fc3ce5e5a',
  'fusio/model' => 'v1.2.9@86ff12a881ddd2c66efb32fb25b4ebcbcf8bb07e',
  'guzzlehttp/guzzle' => '7.4.5@1dd98b0564cb3f6bd16ce683cb755f94c10fbd82',
  'guzzlehttp/promises' => '1.5.1@fe752aedc9fd8fcca3fe7ad05d419d32998a06da',
  'guzzlehttp/psr7' => '2.4.0@13388f00956b1503577598873fffb5ae994b5737',
  'hollodotme/fast-cgi-client' => 'v3.1.7@062182d4eda73c161cc2839783acc83096ec0f37',
  'laminas/laminas-code' => '4.6.0@16ec7577ff315d53ac2e1b1f03a344d8fe680a6e',
  'league/flysystem' => '2.4.5@9392c5f1df57d865c406ee65e5012d566686be12',
  'league/mime-type-detection' => '1.11.0@ff6248ea87a9f116e78edd6002e39e5128a0d4dd',
  'monolog/monolog' => '2.8.0@720488632c590286b88b80e62aa3d3d551ad4a50',
  'nikic/php-parser' => 'v4.14.0@34bea19b6e03d8153165d8f30bba4c3be86184c1',
  'packaged/thrift' => '0.15.0@dbf4e5ff5c85d56ccae62265ed25424b366ce269',
  'phpdocumentor/reflection-common' => '2.2.0@1d01c49d4ed62f25aa84a747ad35d5a16924662b',
  'phpdocumentor/type-resolver' => '1.6.1@77a32518733312af16a44300404e945338981de3',
  'psr/cache' => '3.0.0@aa5030cfa5405eccfdcb1083ce040c2cb8d253bf',
  'psr/container' => '1.1.2@513e0666f7216c7459170d56df27dfcefe1689ea',
  'psr/event-dispatcher' => '1.0.0@dbefd12671e8a14ec7f180cab83036ed26714bb0',
  'psr/http-client' => '1.0.1@2dfb5f6c5eff0e91e20e913f8c5452ed95b86621',
  'psr/http-factory' => '1.0.1@12ac7fcd07e5b077433f5f2bee95b3a771bf61be',
  'psr/http-message' => '1.0.1@f6561bf28d520154e4b0ec72be95418abe6d9363',
  'psr/log' => '3.0.0@fe5ea303b0887d5caefd3d431c3e61ad47037001',
  'psr/simple-cache' => '3.0.0@764e0b3939f5ca87cb904f570ef9be2d78a07865',
  'psx/api' => 'v4.1.4@0ac2991544fd1b488b31dd19922d71ab7563f38b',
  'psx/cloudevents' => 'v1.0.1@4410968e8713daa741423aff2fa1dac38b06cd64',
  'psx/data' => 'v4.0.5@1c10f24b2ef608dde6e8a5562fa6ad8df6de4ff1',
  'psx/datetime' => 'v2.0.2@df4dcd98f27f962a17c22b3d5162d8b92aa1169a',
  'psx/dependency' => 'v2.0.2@d2526651c6f40b4e2740edb146ae0d5921a8c407',
  'psx/engine' => 'v1.0.0@e0a75d62dd0fb658d30cef5ad78b3ff6eca1f283',
  'psx/framework' => 'v6.0.8@fc41778c2c40f62796f93534b38ee84f0e752116',
  'psx/http' => 'v3.0.4@7cd8425c23d721d638a1f593832a0f5685d634bf',
  'psx/json' => 'v2.0.1@283236718ea16510f98bcbdfa48518401a23ce7d',
  'psx/model' => 'v4.0.1@da043a4a8cf8de4e750e7450fcef674a0d9c3c5d',
  'psx/oauth2' => 'v3.0.2@edfdd7d5e00ddd2a8b6f916e61d4fb21776fb492',
  'psx/openssl' => 'v2.0.1@c9fa83560b1a7b4f228b0d78e91485638d101466',
  'psx/record' => 'v2.0.3@84802b1dd9a45519a5e265d38002742f794afc00',
  'psx/sandbox' => 'v0.3.1@52a9e4ce9d4267103ed2361550c15db97934c22a',
  'psx/schema' => 'v4.1.1@e65860ce1a4ea9451f08527ba4f5cfebcd43491f',
  'psx/sql' => 'v3.1.5@3bdbd9332e5d70312e72acd5b3b1de420edf1d4c',
  'psx/uri' => 'v2.0.1@0b5256ac6f61ade12732b04c384bcb56609bd415',
  'psx/validate' => 'v2.0.0@fd33e1bcd541edd822d8d9df053033e673ecb2c1',
  'ralouphie/getallheaders' => '3.0.3@120b605dfeb996808c31b6477290a714d356e822',
  'ramsey/collection' => '1.2.2@cccc74ee5e328031b15640b51056ee8d3bb66c0a',
  'ramsey/uuid' => '4.4.0@373f7bacfcf3de038778ff27dcce5672ddbf4c8a',
  'symfony/cache' => 'v6.0.11@8c98079892d254b4e5806bedf694bddab8fe92b4',
  'symfony/cache-contracts' => 'v3.0.2@1c0a181c9ee221afe4fa55b2d13fc63c5ae14348',
  'symfony/console' => 'v5.3.16@2e322c76cdccb302af6b275ea2207169c8355328',
  'symfony/deprecation-contracts' => 'v2.5.2@e8b495ea28c1d97b5e0c121748d6f9b53d075c66',
  'symfony/dotenv' => 'v6.0.5@1c2288fdfd0787288cd04b9868f879f2212159c4',
  'symfony/event-dispatcher' => 'v6.0.9@5c85b58422865d42c6eb46f7693339056db098a8',
  'symfony/event-dispatcher-contracts' => 'v3.0.2@7bc61cc2db649b4637d331240c5346dcc7708051',
  'symfony/filesystem' => 'v6.0.11@33787a6b6e055245d5710697dfc4a9a2b896c032',
  'symfony/mailer' => 'v6.0.11@4a787a257addd412eac53157d459f87f8e335037',
  'symfony/mime' => 'v6.0.11@c6f16f6789587348f6518b193d3499c0e1f5e5c5',
  'symfony/polyfill-ctype' => 'v1.26.0@6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4',
  'symfony/polyfill-intl-grapheme' => 'v1.26.0@433d05519ce6990bf3530fba6957499d327395c2',
  'symfony/polyfill-intl-idn' => 'v1.26.0@59a8d271f00dd0e4c2e518104cc7963f655a1aa8',
  'symfony/polyfill-intl-normalizer' => 'v1.26.0@219aa369ceff116e673852dce47c3a41794c14bd',
  'symfony/polyfill-mbstring' => 'v1.26.0@9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e',
  'symfony/polyfill-php72' => 'v1.26.0@bf44a9fd41feaac72b074de600314a93e2ae78e2',
  'symfony/polyfill-php73' => 'v1.26.0@e440d35fa0286f77fb45b79a03fedbeda9307e85',
  'symfony/polyfill-php80' => 'v1.26.0@cfa0ae98841b9e461207c13ab093d76b0fa7bace',
  'symfony/polyfill-php81' => 'v1.26.0@13f6d1271c663dc5ae9fb843a8f16521db7687a1',
  'symfony/process' => 'v6.0.11@44270a08ccb664143dede554ff1c00aaa2247a43',
  'symfony/property-access' => 'v6.0.11@8299bd756989ef04be53e2099e6b6fd5154a03ed',
  'symfony/property-info' => 'v6.0.11@518f172491b9c09afd5d963f783909b80c4b0308',
  'symfony/service-contracts' => 'v2.5.2@4b426aac47d6427cc1a1d0f7e2ac724627f5966c',
  'symfony/stopwatch' => 'v5.4.5@4d04b5c24f3c9a1a168a131f6cbe297155bc0d30',
  'symfony/string' => 'v5.4.11@5eb661e49ad389e4ae2b6e4df8d783a8a6548322',
  'symfony/var-exporter' => 'v6.0.10@e3df004a8d0fb572c420a6915cd23db9254c8366',
  'symfony/yaml' => 'v5.4.11@05d4ea560f3402c6c116afd99fdc66e60eda227e',
  'twig/twig' => 'v3.4.1@e939eae92386b69b49cfa4599dd9bead6bf4a342',
  'webmozart/assert' => '1.11.0@11cb2199493b2f8a3b53e7f19068fc6aac760991',
  'fusio/fusio' => 'v3.2.2@406ee75365ba3bab44c9829ae46fc96410696311',
);

    private function __construct()
    {
    }

    /**
     * @psalm-pure
     *
     * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not
     *                                  cause any side effects here.
     */
    public static function rootPackageName() : string
    {
        if (!self::composer2ApiUsable()) {
            return self::ROOT_PACKAGE_NAME;
        }

        return InstalledVersions::getRootPackage()['name'];
    }

    /**
     * @throws OutOfBoundsException If a version cannot be located.
     *
     * @psalm-param key-of<self::VERSIONS> $packageName
     * @psalm-pure
     *
     * @psalm-suppress ImpureMethodCall we know that {@see InstalledVersions} interaction does not
     *                                  cause any side effects here.
     */
    public static function getVersion(string $packageName): string
    {
        if (self::composer2ApiUsable()) {
            return InstalledVersions::getPrettyVersion($packageName)
                . '@' . InstalledVersions::getReference($packageName);
        }

        if (isset(self::VERSIONS[$packageName])) {
            return self::VERSIONS[$packageName];
        }

        throw new OutOfBoundsException(
            'Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files'
        );
    }

    private static function composer2ApiUsable(): bool
    {
        if (!class_exists(InstalledVersions::class, false)) {
            return false;
        }

        if (method_exists(InstalledVersions::class, 'getAllRawData')) {
            $rawData = InstalledVersions::getAllRawData();
            if (count($rawData) === 1 && count($rawData[0]) === 0) {
                return false;
            }
        } else {
            $rawData = InstalledVersions::getRawData();
            if ($rawData === null || $rawData === []) {
                return false;
            }
        }

        return true;
    }
}
