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

namespace Google\Cloud\DiscoveryEngine\V1beta;

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

/**
 * Fact Chunk.
 *
 * Generated from protobuf message <code>google.cloud.discoveryengine.v1beta.FactChunk</code>
 */
class FactChunk extends \Google\Protobuf\Internal\Message
{
    /**
     * Text content of the fact chunk. Can be at most 10K characters long.
     *
     * Generated from protobuf field <code>string chunk_text = 1;</code>
     */
    protected $chunk_text = '';
    /**
     * Source from which this fact chunk was retrieved. If it was retrieved
     * from the GroundingFacts provided in the request then this field will
     * contain the index of the specific fact from which this chunk was
     * retrieved.
     *
     * Generated from protobuf field <code>string source = 2;</code>
     */
    protected $source = '';
    /**
     * The index of this chunk. Currently, only used for the streaming mode.
     *
     * Generated from protobuf field <code>int32 index = 4;</code>
     */
    protected $index = 0;
    /**
     * More fine-grained information for the source reference.
     *
     * Generated from protobuf field <code>map<string, string> source_metadata = 3;</code>
     */
    private $source_metadata;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $chunk_text
     *           Text content of the fact chunk. Can be at most 10K characters long.
     *     @type string $source
     *           Source from which this fact chunk was retrieved. If it was retrieved
     *           from the GroundingFacts provided in the request then this field will
     *           contain the index of the specific fact from which this chunk was
     *           retrieved.
     *     @type int $index
     *           The index of this chunk. Currently, only used for the streaming mode.
     *     @type array|\Google\Protobuf\Internal\MapField $source_metadata
     *           More fine-grained information for the source reference.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\Grounding::initOnce();
        parent::__construct($data);
    }

    /**
     * Text content of the fact chunk. Can be at most 10K characters long.
     *
     * Generated from protobuf field <code>string chunk_text = 1;</code>
     * @return string
     */
    public function getChunkText()
    {
        return $this->chunk_text;
    }

    /**
     * Text content of the fact chunk. Can be at most 10K characters long.
     *
     * Generated from protobuf field <code>string chunk_text = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setChunkText($var)
    {
        GPBUtil::checkString($var, True);
        $this->chunk_text = $var;

        return $this;
    }

    /**
     * Source from which this fact chunk was retrieved. If it was retrieved
     * from the GroundingFacts provided in the request then this field will
     * contain the index of the specific fact from which this chunk was
     * retrieved.
     *
     * Generated from protobuf field <code>string source = 2;</code>
     * @return string
     */
    public function getSource()
    {
        return $this->source;
    }

    /**
     * Source from which this fact chunk was retrieved. If it was retrieved
     * from the GroundingFacts provided in the request then this field will
     * contain the index of the specific fact from which this chunk was
     * retrieved.
     *
     * Generated from protobuf field <code>string source = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setSource($var)
    {
        GPBUtil::checkString($var, True);
        $this->source = $var;

        return $this;
    }

    /**
     * The index of this chunk. Currently, only used for the streaming mode.
     *
     * Generated from protobuf field <code>int32 index = 4;</code>
     * @return int
     */
    public function getIndex()
    {
        return $this->index;
    }

    /**
     * The index of this chunk. Currently, only used for the streaming mode.
     *
     * Generated from protobuf field <code>int32 index = 4;</code>
     * @param int $var
     * @return $this
     */
    public function setIndex($var)
    {
        GPBUtil::checkInt32($var);
        $this->index = $var;

        return $this;
    }

    /**
     * More fine-grained information for the source reference.
     *
     * Generated from protobuf field <code>map<string, string> source_metadata = 3;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getSourceMetadata()
    {
        return $this->source_metadata;
    }

    /**
     * More fine-grained information for the source reference.
     *
     * Generated from protobuf field <code>map<string, string> source_metadata = 3;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setSourceMetadata($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
        $this->source_metadata = $arr;

        return $this;
    }

}

