<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/devtools/cloudtrace/v2/trace.proto

namespace Google\Cloud\Trace\V2;

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

/**
 * A time-stamped annotation or message event in the Span.
 *
 * Generated from protobuf message <code>google.devtools.cloudtrace.v2.Span.TimeEvent</code>
 */
class Span_TimeEvent extends \Google\Protobuf\Internal\Message
{
    /**
     * The timestamp indicating the time the event occurred.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp time = 1;</code>
     */
    private $time = null;
    protected $value;

    public function __construct() {
        \GPBMetadata\Google\Devtools\Cloudtrace\V2\Trace::initOnce();
        parent::__construct();
    }

    /**
     * The timestamp indicating the time the event occurred.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp time = 1;</code>
     * @return \Google\Protobuf\Timestamp
     */
    public function getTime()
    {
        return $this->time;
    }

    /**
     * The timestamp indicating the time the event occurred.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp time = 1;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->time = $var;

        return $this;
    }

    /**
     * Text annotation with a set of attributes.
     *
     * Generated from protobuf field <code>.google.devtools.cloudtrace.v2.Span.TimeEvent.Annotation annotation = 2;</code>
     * @return \Google\Cloud\Trace\V2\Span_TimeEvent_Annotation
     */
    public function getAnnotation()
    {
        return $this->readOneof(2);
    }

    /**
     * Text annotation with a set of attributes.
     *
     * Generated from protobuf field <code>.google.devtools.cloudtrace.v2.Span.TimeEvent.Annotation annotation = 2;</code>
     * @param \Google\Cloud\Trace\V2\Span_TimeEvent_Annotation $var
     * @return $this
     */
    public function setAnnotation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span_TimeEvent_Annotation::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * An event describing a message sent/received between Spans.
     *
     * Generated from protobuf field <code>.google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent message_event = 3;</code>
     * @return \Google\Cloud\Trace\V2\Span_TimeEvent_MessageEvent
     */
    public function getMessageEvent()
    {
        return $this->readOneof(3);
    }

    /**
     * An event describing a message sent/received between Spans.
     *
     * Generated from protobuf field <code>.google.devtools.cloudtrace.v2.Span.TimeEvent.MessageEvent message_event = 3;</code>
     * @param \Google\Cloud\Trace\V2\Span_TimeEvent_MessageEvent $var
     * @return $this
     */
    public function setMessageEvent($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Trace\V2\Span_TimeEvent_MessageEvent::class);
        $this->writeOneof(3, $var);

        return $this;
    }

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

}

