<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: keyapis/device/v1/keyapis_device_device_v1.proto

namespace Keyapis\Device\V1\Preset\Syslog;

use UnexpectedValueException;

/**
 * Тип протокола.
 * # Тип: byte
 *
 * Protobuf type <code>keyapis.device.v1.Preset.Syslog.ProtocolType</code>
 */
class ProtocolType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>PROTOCOL_TYPE_UNKNOWN = 0;</code>
     */
    const PROTOCOL_TYPE_UNKNOWN = 0;
    /**
     * Протокол UDP
     *
     * Generated from protobuf enum <code>UDP = 1;</code>
     */
    const UDP = 1;
    /**
     * Протокол TCP
     *
     * Generated from protobuf enum <code>TCP = 2;</code>
     */
    const TCP = 2;

    private static $valueToName = [
        self::PROTOCOL_TYPE_UNKNOWN => 'PROTOCOL_TYPE_UNKNOWN',
        self::UDP => 'UDP',
        self::TCP => 'TCP',
    ];

    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);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ProtocolType::class, \Keyapis\Device\V1\Preset_Syslog_ProtocolType::class);

