<?php
 
 
 

namespace Google\Protobuf\Internal;

use UnexpectedValueException;






class Edition
{
    




    const EDITION_UNKNOWN = 0;
    





    const EDITION_LEGACY = 900;
    







    const EDITION_PROTO2 = 998;
    


    const EDITION_PROTO3 = 999;
    






    const EDITION_2023 = 1000;
    


    const EDITION_2024 = 1001;
    





    const EDITION_1_TEST_ONLY = 1;
    


    const EDITION_2_TEST_ONLY = 2;
    


    const EDITION_99997_TEST_ONLY = 99997;
    


    const EDITION_99998_TEST_ONLY = 99998;
    


    const EDITION_99999_TEST_ONLY = 99999;
    






    const EDITION_MAX = 2147483647;

    private static $valueToName = [
        self::EDITION_UNKNOWN => 'EDITION_UNKNOWN',
        self::EDITION_LEGACY => 'EDITION_LEGACY',
        self::EDITION_PROTO2 => 'EDITION_PROTO2',
        self::EDITION_PROTO3 => 'EDITION_PROTO3',
        self::EDITION_2023 => 'EDITION_2023',
        self::EDITION_2024 => 'EDITION_2024',
        self::EDITION_1_TEST_ONLY => 'EDITION_1_TEST_ONLY',
        self::EDITION_2_TEST_ONLY => 'EDITION_2_TEST_ONLY',
        self::EDITION_99997_TEST_ONLY => 'EDITION_99997_TEST_ONLY',
        self::EDITION_99998_TEST_ONLY => 'EDITION_99998_TEST_ONLY',
        self::EDITION_99999_TEST_ONLY => 'EDITION_99999_TEST_ONLY',
        self::EDITION_MAX => 'EDITION_MAX',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

