<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/devtools/clouderrorreporting/v1beta1/report_errors_service.proto

namespace Google\Cloud\ErrorReporting\V1beta1;

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

/**
 * An error event which is reported to the Error Reporting system.
 *
 * Generated from protobuf message <code>google.devtools.clouderrorreporting.v1beta1.ReportedErrorEvent</code>
 */
class ReportedErrorEvent extends \Google\Protobuf\Internal\Message
{
    /**
     * [Optional] Time when the event occurred.
     * If not provided, the time when the event was received by the
     * Error Reporting system will be used.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp event_time = 1;</code>
     */
    private $event_time = null;
    /**
     * [Required] The service context in which this error has occurred.
     *
     * Generated from protobuf field <code>.google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2;</code>
     */
    private $service_context = null;
    /**
     * [Required] A message describing the error. The message can contain an
     * exception stack in one of the supported programming languages and formats.
     * In that case, the message is parsed and detailed exception information
     * is returned when retrieving the error event again.
     *
     * Generated from protobuf field <code>string message = 3;</code>
     */
    private $message = '';
    /**
     * [Optional] A description of the context in which the error occurred.
     *
     * Generated from protobuf field <code>.google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 4;</code>
     */
    private $context = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Protobuf\Timestamp $event_time
     *           [Optional] Time when the event occurred.
     *           If not provided, the time when the event was received by the
     *           Error Reporting system will be used.
     *     @type \Google\Cloud\ErrorReporting\V1beta1\ServiceContext $service_context
     *           [Required] The service context in which this error has occurred.
     *     @type string $message
     *           [Required] A message describing the error. The message can contain an
     *           exception stack in one of the supported programming languages and formats.
     *           In that case, the message is parsed and detailed exception information
     *           is returned when retrieving the error event again.
     *     @type \Google\Cloud\ErrorReporting\V1beta1\ErrorContext $context
     *           [Optional] A description of the context in which the error occurred.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Devtools\Clouderrorreporting\V1Beta1\ReportErrorsService::initOnce();
        parent::__construct($data);
    }

    /**
     * [Optional] Time when the event occurred.
     * If not provided, the time when the event was received by the
     * Error Reporting system will be used.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp event_time = 1;</code>
     * @return \Google\Protobuf\Timestamp
     */
    public function getEventTime()
    {
        return $this->event_time;
    }

    /**
     * [Optional] Time when the event occurred.
     * If not provided, the time when the event was received by the
     * Error Reporting system will be used.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp event_time = 1;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setEventTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->event_time = $var;

        return $this;
    }

    /**
     * [Required] The service context in which this error has occurred.
     *
     * Generated from protobuf field <code>.google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2;</code>
     * @return \Google\Cloud\ErrorReporting\V1beta1\ServiceContext
     */
    public function getServiceContext()
    {
        return $this->service_context;
    }

    /**
     * [Required] The service context in which this error has occurred.
     *
     * Generated from protobuf field <code>.google.devtools.clouderrorreporting.v1beta1.ServiceContext service_context = 2;</code>
     * @param \Google\Cloud\ErrorReporting\V1beta1\ServiceContext $var
     * @return $this
     */
    public function setServiceContext($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ServiceContext::class);
        $this->service_context = $var;

        return $this;
    }

    /**
     * [Required] A message describing the error. The message can contain an
     * exception stack in one of the supported programming languages and formats.
     * In that case, the message is parsed and detailed exception information
     * is returned when retrieving the error event again.
     *
     * Generated from protobuf field <code>string message = 3;</code>
     * @return string
     */
    public function getMessage()
    {
        return $this->message;
    }

    /**
     * [Required] A message describing the error. The message can contain an
     * exception stack in one of the supported programming languages and formats.
     * In that case, the message is parsed and detailed exception information
     * is returned when retrieving the error event again.
     *
     * Generated from protobuf field <code>string message = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setMessage($var)
    {
        GPBUtil::checkString($var, True);
        $this->message = $var;

        return $this;
    }

    /**
     * [Optional] A description of the context in which the error occurred.
     *
     * Generated from protobuf field <code>.google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 4;</code>
     * @return \Google\Cloud\ErrorReporting\V1beta1\ErrorContext
     */
    public function getContext()
    {
        return $this->context;
    }

    /**
     * [Optional] A description of the context in which the error occurred.
     *
     * Generated from protobuf field <code>.google.devtools.clouderrorreporting.v1beta1.ErrorContext context = 4;</code>
     * @param \Google\Cloud\ErrorReporting\V1beta1\ErrorContext $var
     * @return $this
     */
    public function setContext($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\ErrorReporting\V1beta1\ErrorContext::class);
        $this->context = $var;

        return $this;
    }

}

