<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: packet.proto

namespace OS\PB;

use UnexpectedValueException;

/**
 * Protobuf type <code>OS.PB.PacketSequenceNumber</code>
 */
class PacketSequenceNumber
{
    /**
     * Sequence number of zero is not permitted, therefore it is considered NotSet
     *
     * Generated from protobuf enum <code>SequenceNumber_NotSet = 0;</code>
     */
    const SequenceNumber_NotSet = 0;
    /**
     * This means that the connection reset and sequence number starts from the beginning again
     *
     * Generated from protobuf enum <code>SequenceNumber_Reset = 1;</code>
     */
    const SequenceNumber_Reset = 1;
    /**
     * If preceded by a WrapAround, then this is just the starting point instead of NotSet or Reset. 
     *
     * Generated from protobuf enum <code>SequenceNumber_WrapStart = 2;</code>
     */
    const SequenceNumber_WrapStart = 2;
    /**
     * The max value of sequence number, it is limited to 127 to prevent varint encoding a second byte
     *
     * Generated from protobuf enum <code>SequenceNumber_WrapAround = 127;</code>
     */
    const SequenceNumber_WrapAround = 127;

    private static $valueToName = [
        self::SequenceNumber_NotSet => 'SequenceNumber_NotSet',
        self::SequenceNumber_Reset => 'SequenceNumber_Reset',
        self::SequenceNumber_WrapStart => 'SequenceNumber_WrapStart',
        self::SequenceNumber_WrapAround => 'SequenceNumber_WrapAround',
    ];

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

