<?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.MessageFlags</code>
 */
class MessageFlags
{
    /**
     * Valid MessageFlags
     *
     * Generated from protobuf enum <code>MessageFlags_NotSet = 0;</code>
     */
    const MessageFlags_NotSet = 0;
    /**
     * Propagate this Message to all queues, except to the Sender's queue regardless if its offline or not.
     *
     * Generated from protobuf enum <code>Message_Propagate = 1;</code>
     */
    const Message_Propagate = 1;
    /**
     * Propagate but explicedly excludes Cloud queue with DeviceId (1). Used in local network only.
     *
     * Generated from protobuf enum <code>Message_Propagate_NoCloud = 3;</code>
     */
    const Message_Propagate_NoCloud = 3;
    /**
     * Propagate but exclude queues that are offline
     *
     * Generated from protobuf enum <code>Message_Propagate_Online = 5;</code>
     */
    const Message_Propagate_Online = 5;
    /**
     * Propagate but exclude offline queues and cloud queue
     *
     * Generated from protobuf enum <code>Message_Propagate_NoCloud_Online = 7;</code>
     */
    const Message_Propagate_NoCloud_Online = 7;
    /**
     * Masks for bit manipulation
     *
     * Generated from protobuf enum <code>MessageMask_Propagate = 15;</code>
     */
    const MessageMask_Propagate = 15;
    /**
     * Flag bits for masking
     *
     * Generated from protobuf enum <code>MessageFlag_Propagate = 1;</code>
     */
    const MessageFlag_Propagate = 1;
    /**
     * Explicedtly exclude the Cloud queue
     *
     * Generated from protobuf enum <code>MessageFlag_NoCloud = 2;</code>
     */
    const MessageFlag_NoCloud = 2;
    /**
     * Queue must be online (ie: at least one live Connection)
     *
     * Generated from protobuf enum <code>MessageFlag_Online = 4;</code>
     */
    const MessageFlag_Online = 4;

    private static $valueToName = [
        self::MessageFlags_NotSet => 'MessageFlags_NotSet',
        self::Message_Propagate => 'Message_Propagate',
        self::Message_Propagate_NoCloud => 'Message_Propagate_NoCloud',
        self::Message_Propagate_Online => 'Message_Propagate_Online',
        self::Message_Propagate_NoCloud_Online => 'Message_Propagate_NoCloud_Online',
        self::MessageMask_Propagate => 'MessageMask_Propagate',
        self::MessageFlag_Propagate => 'MessageFlag_Propagate',
        self::MessageFlag_NoCloud => 'MessageFlag_NoCloud',
        self::MessageFlag_Online => 'MessageFlag_Online',
    ];

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

