<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/aiplatform/v1/content.proto

namespace Google\Cloud\AIPlatform\V1\GroundingChunk;

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

/**
 * Chunk from context retrieved by the retrieval tools.
 *
 * Generated from protobuf message <code>google.cloud.aiplatform.v1.GroundingChunk.RetrievedContext</code>
 */
class RetrievedContext extends \Google\Protobuf\Internal\Message
{
    /**
     * URI reference of the attribution.
     *
     * Generated from protobuf field <code>optional string uri = 1;</code>
     */
    protected $uri = null;
    /**
     * Title of the attribution.
     *
     * Generated from protobuf field <code>optional string title = 2;</code>
     */
    protected $title = null;
    /**
     * Text of the attribution.
     *
     * Generated from protobuf field <code>optional string text = 3;</code>
     */
    protected $text = null;
    protected $context_details;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\AIPlatform\V1\RagChunk $rag_chunk
     *           Additional context for the RAG retrieval result. This is only populated
     *           when using the RAG retrieval tool.
     *     @type string $uri
     *           URI reference of the attribution.
     *     @type string $title
     *           Title of the attribution.
     *     @type string $text
     *           Text of the attribution.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Aiplatform\V1\Content::initOnce();
        parent::__construct($data);
    }

    /**
     * Additional context for the RAG retrieval result. This is only populated
     * when using the RAG retrieval tool.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.RagChunk rag_chunk = 4;</code>
     * @return \Google\Cloud\AIPlatform\V1\RagChunk|null
     */
    public function getRagChunk()
    {
        return $this->readOneof(4);
    }

    public function hasRagChunk()
    {
        return $this->hasOneof(4);
    }

    /**
     * Additional context for the RAG retrieval result. This is only populated
     * when using the RAG retrieval tool.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.RagChunk rag_chunk = 4;</code>
     * @param \Google\Cloud\AIPlatform\V1\RagChunk $var
     * @return $this
     */
    public function setRagChunk($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\RagChunk::class);
        $this->writeOneof(4, $var);

        return $this;
    }

    /**
     * URI reference of the attribution.
     *
     * Generated from protobuf field <code>optional string uri = 1;</code>
     * @return string
     */
    public function getUri()
    {
        return isset($this->uri) ? $this->uri : '';
    }

    public function hasUri()
    {
        return isset($this->uri);
    }

    public function clearUri()
    {
        unset($this->uri);
    }

    /**
     * URI reference of the attribution.
     *
     * Generated from protobuf field <code>optional string uri = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setUri($var)
    {
        GPBUtil::checkString($var, True);
        $this->uri = $var;

        return $this;
    }

    /**
     * Title of the attribution.
     *
     * Generated from protobuf field <code>optional string title = 2;</code>
     * @return string
     */
    public function getTitle()
    {
        return isset($this->title) ? $this->title : '';
    }

    public function hasTitle()
    {
        return isset($this->title);
    }

    public function clearTitle()
    {
        unset($this->title);
    }

    /**
     * Title of the attribution.
     *
     * Generated from protobuf field <code>optional string title = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setTitle($var)
    {
        GPBUtil::checkString($var, True);
        $this->title = $var;

        return $this;
    }

    /**
     * Text of the attribution.
     *
     * Generated from protobuf field <code>optional string text = 3;</code>
     * @return string
     */
    public function getText()
    {
        return isset($this->text) ? $this->text : '';
    }

    public function hasText()
    {
        return isset($this->text);
    }

    public function clearText()
    {
        unset($this->text);
    }

    /**
     * Text of the attribution.
     *
     * Generated from protobuf field <code>optional string text = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setText($var)
    {
        GPBUtil::checkString($var, True);
        $this->text = $var;

        return $this;
    }

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

}


