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

namespace PhpWA\Protocol\Proto\ClientPayload;

use UnexpectedValueException;

/**
 * Protobuf type <code>proto.ClientPayload.ConnectReason</code>
 */
class ConnectReason
{
    /**
     * Generated from protobuf enum <code>PUSH = 0;</code>
     */
    const PUSH = 0;
    /**
     * Generated from protobuf enum <code>USER_ACTIVATED = 1;</code>
     */
    const USER_ACTIVATED = 1;
    /**
     * Generated from protobuf enum <code>SCHEDULED = 2;</code>
     */
    const SCHEDULED = 2;
    /**
     * Generated from protobuf enum <code>ERROR_RECONNECT = 3;</code>
     */
    const ERROR_RECONNECT = 3;
    /**
     * Generated from protobuf enum <code>NETWORK_SWITCH = 4;</code>
     */
    const NETWORK_SWITCH = 4;
    /**
     * Generated from protobuf enum <code>PING_RECONNECT = 5;</code>
     */
    const PING_RECONNECT = 5;
    /**
     * Generated from protobuf enum <code>UNKNOWN = 6;</code>
     */
    const UNKNOWN = 6;

    private static $valueToName = [
        self::PUSH => 'PUSH',
        self::USER_ACTIVATED => 'USER_ACTIVATED',
        self::SCHEDULED => 'SCHEDULED',
        self::ERROR_RECONNECT => 'ERROR_RECONNECT',
        self::NETWORK_SWITCH => 'NETWORK_SWITCH',
        self::PING_RECONNECT => 'PING_RECONNECT',
        self::UNKNOWN => 'UNKNOWN',
    ];

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

