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

namespace OS\PB;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * Generated from protobuf message <code>OS.PB.Message</code>
 */
class Message extends \Google\Protobuf\Internal\Message
{
    /**
     * When this message was generated. 0 means current time is unknown.
     *
     * Generated from protobuf field <code>int64 TimeStampMs = 1;</code>
     */
    protected $TimeStampMs = 0;
    /**
     * 0 to use configured default TTL in seconds. -1 for infinite. If expired, this message is not encoded and removed from queue to be sent.
     *
     * Generated from protobuf field <code>int64 TimeToLive = 2;</code>
     */
    protected $TimeToLive = 0;
    /**
     * 0 means this message has no correlation to any other messages.
     *
     * Generated from protobuf field <code>uint64 CorrelationId = 3;</code>
     */
    protected $CorrelationId = 0;
    /**
     * 0 is lowest priority, which should be the case for most messages. If a message is higher priority than other messages, it is sent before the others.
     *
     * Generated from protobuf field <code>uint32 Priority = 4;</code>
     */
    protected $Priority = 0;
    /**
     * If true, then this message will be propagated to all other queues on this device, minus the device it was received from. CorrelationId must be set in order to use this Propagation.
     *
     * Generated from protobuf field <code>bool Propagate = 5;</code>
     */
    protected $Propagate = false;
    protected $MessageType;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int|string $TimeStampMs
     *           When this message was generated. 0 means current time is unknown.
     *     @type int|string $TimeToLive
     *           0 to use configured default TTL in seconds. -1 for infinite. If expired, this message is not encoded and removed from queue to be sent.
     *     @type int|string $CorrelationId
     *           0 means this message has no correlation to any other messages.
     *     @type int $Priority
     *           0 is lowest priority, which should be the case for most messages. If a message is higher priority than other messages, it is sent before the others.
     *     @type bool $Propagate
     *           If true, then this message will be propagated to all other queues on this device, minus the device it was received from. CorrelationId must be set in order to use this Propagation.
     *     @type \OS\PB\EventMessage $Event
     *           Events generated by external or action driven stimuli
     *     @type \OS\PB\ActionMessage $Action
     *           Action are generated by devices when a set of conditions is satisfied or the server sends an action (eg: driving a relay)
     *     @type \OS\PB\ConfigMessage $Config
     *           Config is to change persistent data on the destination device
     *     @type \OS\PB\LogMessage $Log
     *           A single line log meant for the cloud
     *     @type \OS\PB\MetricMessage $Metric
     *           Provides statistics on the device that is displayed on Grafana
     *     @type \OS\PB\RequestMessage $Request
     *           A request for some data
     *     @type \OS\PB\ResponseMessage $Response
     *           A response to the RPCRequest
     *     @type string $RoutedPacket
     *           Contains a packet to forward on until it reaches its final destination
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Packet::initOnce();
        parent::__construct($data);
    }

    /**
     * When this message was generated. 0 means current time is unknown.
     *
     * Generated from protobuf field <code>int64 TimeStampMs = 1;</code>
     * @return int|string
     */
    public function getTimeStampMs()
    {
        return $this->TimeStampMs;
    }

    /**
     * When this message was generated. 0 means current time is unknown.
     *
     * Generated from protobuf field <code>int64 TimeStampMs = 1;</code>
     * @param int|string $var
     * @return $this
     */
    public function setTimeStampMs($var)
    {
        GPBUtil::checkInt64($var);
        $this->TimeStampMs = $var;

        return $this;
    }

    /**
     * 0 to use configured default TTL in seconds. -1 for infinite. If expired, this message is not encoded and removed from queue to be sent.
     *
     * Generated from protobuf field <code>int64 TimeToLive = 2;</code>
     * @return int|string
     */
    public function getTimeToLive()
    {
        return $this->TimeToLive;
    }

    /**
     * 0 to use configured default TTL in seconds. -1 for infinite. If expired, this message is not encoded and removed from queue to be sent.
     *
     * Generated from protobuf field <code>int64 TimeToLive = 2;</code>
     * @param int|string $var
     * @return $this
     */
    public function setTimeToLive($var)
    {
        GPBUtil::checkInt64($var);
        $this->TimeToLive = $var;

        return $this;
    }

    /**
     * 0 means this message has no correlation to any other messages.
     *
     * Generated from protobuf field <code>uint64 CorrelationId = 3;</code>
     * @return int|string
     */
    public function getCorrelationId()
    {
        return $this->CorrelationId;
    }

    /**
     * 0 means this message has no correlation to any other messages.
     *
     * Generated from protobuf field <code>uint64 CorrelationId = 3;</code>
     * @param int|string $var
     * @return $this
     */
    public function setCorrelationId($var)
    {
        GPBUtil::checkUint64($var);
        $this->CorrelationId = $var;

        return $this;
    }

    /**
     * 0 is lowest priority, which should be the case for most messages. If a message is higher priority than other messages, it is sent before the others.
     *
     * Generated from protobuf field <code>uint32 Priority = 4;</code>
     * @return int
     */
    public function getPriority()
    {
        return $this->Priority;
    }

    /**
     * 0 is lowest priority, which should be the case for most messages. If a message is higher priority than other messages, it is sent before the others.
     *
     * Generated from protobuf field <code>uint32 Priority = 4;</code>
     * @param int $var
     * @return $this
     */
    public function setPriority($var)
    {
        GPBUtil::checkUint32($var);
        $this->Priority = $var;

        return $this;
    }

    /**
     * If true, then this message will be propagated to all other queues on this device, minus the device it was received from. CorrelationId must be set in order to use this Propagation.
     *
     * Generated from protobuf field <code>bool Propagate = 5;</code>
     * @return bool
     */
    public function getPropagate()
    {
        return $this->Propagate;
    }

    /**
     * If true, then this message will be propagated to all other queues on this device, minus the device it was received from. CorrelationId must be set in order to use this Propagation.
     *
     * Generated from protobuf field <code>bool Propagate = 5;</code>
     * @param bool $var
     * @return $this
     */
    public function setPropagate($var)
    {
        GPBUtil::checkBool($var);
        $this->Propagate = $var;

        return $this;
    }

    /**
     * Events generated by external or action driven stimuli
     *
     * Generated from protobuf field <code>.OS.PB.EventMessage Event = 6;</code>
     * @return \OS\PB\EventMessage|null
     */
    public function getEvent()
    {
        return $this->readOneof(6);
    }

    public function hasEvent()
    {
        return $this->hasOneof(6);
    }

    /**
     * Events generated by external or action driven stimuli
     *
     * Generated from protobuf field <code>.OS.PB.EventMessage Event = 6;</code>
     * @param \OS\PB\EventMessage $var
     * @return $this
     */
    public function setEvent($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\EventMessage::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * Action are generated by devices when a set of conditions is satisfied or the server sends an action (eg: driving a relay)
     *
     * Generated from protobuf field <code>.OS.PB.ActionMessage Action = 7;</code>
     * @return \OS\PB\ActionMessage|null
     */
    public function getAction()
    {
        return $this->readOneof(7);
    }

    public function hasAction()
    {
        return $this->hasOneof(7);
    }

    /**
     * Action are generated by devices when a set of conditions is satisfied or the server sends an action (eg: driving a relay)
     *
     * Generated from protobuf field <code>.OS.PB.ActionMessage Action = 7;</code>
     * @param \OS\PB\ActionMessage $var
     * @return $this
     */
    public function setAction($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\ActionMessage::class);
        $this->writeOneof(7, $var);

        return $this;
    }

    /**
     * Config is to change persistent data on the destination device
     *
     * Generated from protobuf field <code>.OS.PB.ConfigMessage Config = 8;</code>
     * @return \OS\PB\ConfigMessage|null
     */
    public function getConfig()
    {
        return $this->readOneof(8);
    }

    public function hasConfig()
    {
        return $this->hasOneof(8);
    }

    /**
     * Config is to change persistent data on the destination device
     *
     * Generated from protobuf field <code>.OS.PB.ConfigMessage Config = 8;</code>
     * @param \OS\PB\ConfigMessage $var
     * @return $this
     */
    public function setConfig($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\ConfigMessage::class);
        $this->writeOneof(8, $var);

        return $this;
    }

    /**
     * A single line log meant for the cloud
     *
     * Generated from protobuf field <code>.OS.PB.LogMessage Log = 9;</code>
     * @return \OS\PB\LogMessage|null
     */
    public function getLog()
    {
        return $this->readOneof(9);
    }

    public function hasLog()
    {
        return $this->hasOneof(9);
    }

    /**
     * A single line log meant for the cloud
     *
     * Generated from protobuf field <code>.OS.PB.LogMessage Log = 9;</code>
     * @param \OS\PB\LogMessage $var
     * @return $this
     */
    public function setLog($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\LogMessage::class);
        $this->writeOneof(9, $var);

        return $this;
    }

    /**
     * Provides statistics on the device that is displayed on Grafana
     *
     * Generated from protobuf field <code>.OS.PB.MetricMessage Metric = 10;</code>
     * @return \OS\PB\MetricMessage|null
     */
    public function getMetric()
    {
        return $this->readOneof(10);
    }

    public function hasMetric()
    {
        return $this->hasOneof(10);
    }

    /**
     * Provides statistics on the device that is displayed on Grafana
     *
     * Generated from protobuf field <code>.OS.PB.MetricMessage Metric = 10;</code>
     * @param \OS\PB\MetricMessage $var
     * @return $this
     */
    public function setMetric($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\MetricMessage::class);
        $this->writeOneof(10, $var);

        return $this;
    }

    /**
     * A request for some data
     *
     * Generated from protobuf field <code>.OS.PB.RequestMessage Request = 11;</code>
     * @return \OS\PB\RequestMessage|null
     */
    public function getRequest()
    {
        return $this->readOneof(11);
    }

    public function hasRequest()
    {
        return $this->hasOneof(11);
    }

    /**
     * A request for some data
     *
     * Generated from protobuf field <code>.OS.PB.RequestMessage Request = 11;</code>
     * @param \OS\PB\RequestMessage $var
     * @return $this
     */
    public function setRequest($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\RequestMessage::class);
        $this->writeOneof(11, $var);

        return $this;
    }

    /**
     * A response to the RPCRequest
     *
     * Generated from protobuf field <code>.OS.PB.ResponseMessage Response = 12;</code>
     * @return \OS\PB\ResponseMessage|null
     */
    public function getResponse()
    {
        return $this->readOneof(12);
    }

    public function hasResponse()
    {
        return $this->hasOneof(12);
    }

    /**
     * A response to the RPCRequest
     *
     * Generated from protobuf field <code>.OS.PB.ResponseMessage Response = 12;</code>
     * @param \OS\PB\ResponseMessage $var
     * @return $this
     */
    public function setResponse($var)
    {
        GPBUtil::checkMessage($var, \OS\PB\ResponseMessage::class);
        $this->writeOneof(12, $var);

        return $this;
    }

    /**
     * Contains a packet to forward on until it reaches its final destination
     *
     * Generated from protobuf field <code>bytes RoutedPacket = 15;</code>
     * @return string
     */
    public function getRoutedPacket()
    {
        return $this->readOneof(15);
    }

    public function hasRoutedPacket()
    {
        return $this->hasOneof(15);
    }

    /**
     * Contains a packet to forward on until it reaches its final destination
     *
     * Generated from protobuf field <code>bytes RoutedPacket = 15;</code>
     * @param string $var
     * @return $this
     */
    public function setRoutedPacket($var)
    {
        GPBUtil::checkString($var, False);
        $this->writeOneof(15, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getMessageType()
    {
        return $this->whichOneof("MessageType");
    }

}

