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

namespace Google\Cloud\DiscoveryEngine\V1;

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

/**
 * Base structured datatype containing multi-part content of a message.
 *
 * Generated from protobuf message <code>google.cloud.discoveryengine.v1.GroundedGenerationContent</code>
 */
class GroundedGenerationContent extends \Google\Protobuf\Internal\Message
{
    /**
     * Producer of the content. Must be either `user` or `model`.
     * Intended to be used for multi-turn conversations. Otherwise, it can be left
     * unset.
     *
     * Generated from protobuf field <code>string role = 1;</code>
     */
    protected $role = '';
    /**
     * Ordered `Parts` that constitute a single message.
     *
     * Generated from protobuf field <code>repeated .google.cloud.discoveryengine.v1.GroundedGenerationContent.Part parts = 2;</code>
     */
    private $parts;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $role
     *           Producer of the content. Must be either `user` or `model`.
     *           Intended to be used for multi-turn conversations. Otherwise, it can be left
     *           unset.
     *     @type array<\Google\Cloud\DiscoveryEngine\V1\GroundedGenerationContent\Part>|\Google\Protobuf\Internal\RepeatedField $parts
     *           Ordered `Parts` that constitute a single message.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Discoveryengine\V1\GroundedGenerationService::initOnce();
        parent::__construct($data);
    }

    /**
     * Producer of the content. Must be either `user` or `model`.
     * Intended to be used for multi-turn conversations. Otherwise, it can be left
     * unset.
     *
     * Generated from protobuf field <code>string role = 1;</code>
     * @return string
     */
    public function getRole()
    {
        return $this->role;
    }

    /**
     * Producer of the content. Must be either `user` or `model`.
     * Intended to be used for multi-turn conversations. Otherwise, it can be left
     * unset.
     *
     * Generated from protobuf field <code>string role = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setRole($var)
    {
        GPBUtil::checkString($var, True);
        $this->role = $var;

        return $this;
    }

    /**
     * Ordered `Parts` that constitute a single message.
     *
     * Generated from protobuf field <code>repeated .google.cloud.discoveryengine.v1.GroundedGenerationContent.Part parts = 2;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getParts()
    {
        return $this->parts;
    }

    /**
     * Ordered `Parts` that constitute a single message.
     *
     * Generated from protobuf field <code>repeated .google.cloud.discoveryengine.v1.GroundedGenerationContent.Part parts = 2;</code>
     * @param array<\Google\Cloud\DiscoveryEngine\V1\GroundedGenerationContent\Part>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setParts($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\GroundedGenerationContent\Part::class);
        $this->parts = $arr;

        return $this;
    }

}

