<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/geminidataanalytics/v1beta/data_chat_service.proto

namespace Google\Cloud\GeminiDataAnalytics\V1beta;

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

/**
 * A message from an interaction between the user and the system.
 *
 * Generated from protobuf message <code>google.cloud.geminidataanalytics.v1beta.Message</code>
 */
class Message extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. For user messages, this is the time at which the system
     * received the message. For system messages, this is the time at which the
     * system generated the message.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp timestamp = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $timestamp = null;
    /**
     * Optional. unique id of the message in the conversation for persistence.
     *
     * Generated from protobuf field <code>string message_id = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $message_id = '';
    protected $kind;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\GeminiDataAnalytics\V1beta\UserMessage $user_message
     *           A message from the user that is interacting with the system.
     *     @type \Google\Cloud\GeminiDataAnalytics\V1beta\SystemMessage $system_message
     *           A message from the system in response to the user.
     *     @type \Google\Protobuf\Timestamp $timestamp
     *           Output only. For user messages, this is the time at which the system
     *           received the message. For system messages, this is the time at which the
     *           system generated the message.
     *     @type string $message_id
     *           Optional. unique id of the message in the conversation for persistence.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Geminidataanalytics\V1Beta\DataChatService::initOnce();
        parent::__construct($data);
    }

    /**
     * A message from the user that is interacting with the system.
     *
     * Generated from protobuf field <code>.google.cloud.geminidataanalytics.v1beta.UserMessage user_message = 2;</code>
     * @return \Google\Cloud\GeminiDataAnalytics\V1beta\UserMessage|null
     */
    public function getUserMessage()
    {
        return $this->readOneof(2);
    }

    public function hasUserMessage()
    {
        return $this->hasOneof(2);
    }

    /**
     * A message from the user that is interacting with the system.
     *
     * Generated from protobuf field <code>.google.cloud.geminidataanalytics.v1beta.UserMessage user_message = 2;</code>
     * @param \Google\Cloud\GeminiDataAnalytics\V1beta\UserMessage $var
     * @return $this
     */
    public function setUserMessage($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\GeminiDataAnalytics\V1beta\UserMessage::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * A message from the system in response to the user.
     *
     * Generated from protobuf field <code>.google.cloud.geminidataanalytics.v1beta.SystemMessage system_message = 3;</code>
     * @return \Google\Cloud\GeminiDataAnalytics\V1beta\SystemMessage|null
     */
    public function getSystemMessage()
    {
        return $this->readOneof(3);
    }

    public function hasSystemMessage()
    {
        return $this->hasOneof(3);
    }

    /**
     * A message from the system in response to the user.
     *
     * Generated from protobuf field <code>.google.cloud.geminidataanalytics.v1beta.SystemMessage system_message = 3;</code>
     * @param \Google\Cloud\GeminiDataAnalytics\V1beta\SystemMessage $var
     * @return $this
     */
    public function setSystemMessage($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\GeminiDataAnalytics\V1beta\SystemMessage::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * Output only. For user messages, this is the time at which the system
     * received the message. For system messages, this is the time at which the
     * system generated the message.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp timestamp = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getTimestamp()
    {
        return $this->timestamp;
    }

    public function hasTimestamp()
    {
        return isset($this->timestamp);
    }

    public function clearTimestamp()
    {
        unset($this->timestamp);
    }

    /**
     * Output only. For user messages, this is the time at which the system
     * received the message. For system messages, this is the time at which the
     * system generated the message.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp timestamp = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setTimestamp($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->timestamp = $var;

        return $this;
    }

    /**
     * Optional. unique id of the message in the conversation for persistence.
     *
     * Generated from protobuf field <code>string message_id = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getMessageId()
    {
        return $this->message_id;
    }

    /**
     * Optional. unique id of the message in the conversation for persistence.
     *
     * Generated from protobuf field <code>string message_id = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setMessageId($var)
    {
        GPBUtil::checkString($var, True);
        $this->message_id = $var;

        return $this;
    }

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

}

