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

namespace Google\Cloud\AIPlatform\V1;

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

/**
 * Grounding chunk.
 *
 * Generated from protobuf message <code>google.cloud.aiplatform.v1.GroundingChunk</code>
 */
class GroundingChunk extends \Google\Protobuf\Internal\Message
{
    protected $chunk_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\AIPlatform\V1\GroundingChunk\Web $web
     *           Grounding chunk from the web.
     *     @type \Google\Cloud\AIPlatform\V1\GroundingChunk\RetrievedContext $retrieved_context
     *           Grounding chunk from context retrieved by the retrieval tools.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Aiplatform\V1\Content::initOnce();
        parent::__construct($data);
    }

    /**
     * Grounding chunk from the web.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.GroundingChunk.Web web = 1;</code>
     * @return \Google\Cloud\AIPlatform\V1\GroundingChunk\Web|null
     */
    public function getWeb()
    {
        return $this->readOneof(1);
    }

    public function hasWeb()
    {
        return $this->hasOneof(1);
    }

    /**
     * Grounding chunk from the web.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.GroundingChunk.Web web = 1;</code>
     * @param \Google\Cloud\AIPlatform\V1\GroundingChunk\Web $var
     * @return $this
     */
    public function setWeb($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\GroundingChunk\Web::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Grounding chunk from context retrieved by the retrieval tools.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.GroundingChunk.RetrievedContext retrieved_context = 2;</code>
     * @return \Google\Cloud\AIPlatform\V1\GroundingChunk\RetrievedContext|null
     */
    public function getRetrievedContext()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Grounding chunk from context retrieved by the retrieval tools.
     *
     * Generated from protobuf field <code>.google.cloud.aiplatform.v1.GroundingChunk.RetrievedContext retrieved_context = 2;</code>
     * @param \Google\Cloud\AIPlatform\V1\GroundingChunk\RetrievedContext $var
     * @return $this
     */
    public function setRetrievedContext($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\AIPlatform\V1\GroundingChunk\RetrievedContext::class);
        $this->writeOneof(2, $var);

        return $this;
    }

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

}

