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

namespace Google\Cloud\DiscoveryEngine\V1\Document;

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

/**
 * Index status of the document.
 *
 * Generated from protobuf message <code>google.cloud.discoveryengine.v1.Document.IndexStatus</code>
 */
class IndexStatus extends \Google\Protobuf\Internal\Message
{
    /**
     * The time when the document was indexed.
     * If this field is populated, it means the document has been indexed.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp index_time = 1;</code>
     */
    protected $index_time = null;
    /**
     * A sample of errors encountered while indexing the document.
     * If this field is populated, the document is not indexed due to errors.
     *
     * Generated from protobuf field <code>repeated .google.rpc.Status error_samples = 2;</code>
     */
    private $error_samples;
    /**
     * Immutable. The message indicates the document index is in progress.
     * If this field is populated, the document index is pending.
     *
     * Generated from protobuf field <code>string pending_message = 3 [(.google.api.field_behavior) = IMMUTABLE];</code>
     */
    protected $pending_message = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Protobuf\Timestamp $index_time
     *           The time when the document was indexed.
     *           If this field is populated, it means the document has been indexed.
     *     @type \Google\Rpc\Status[] $error_samples
     *           A sample of errors encountered while indexing the document.
     *           If this field is populated, the document is not indexed due to errors.
     *     @type string $pending_message
     *           Immutable. The message indicates the document index is in progress.
     *           If this field is populated, the document index is pending.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Discoveryengine\V1\Document::initOnce();
        parent::__construct($data);
    }

    /**
     * The time when the document was indexed.
     * If this field is populated, it means the document has been indexed.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp index_time = 1;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getIndexTime()
    {
        return $this->index_time;
    }

    public function hasIndexTime()
    {
        return isset($this->index_time);
    }

    public function clearIndexTime()
    {
        unset($this->index_time);
    }

    /**
     * The time when the document was indexed.
     * If this field is populated, it means the document has been indexed.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp index_time = 1;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setIndexTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->index_time = $var;

        return $this;
    }

    /**
     * A sample of errors encountered while indexing the document.
     * If this field is populated, the document is not indexed due to errors.
     *
     * Generated from protobuf field <code>repeated .google.rpc.Status error_samples = 2;</code>
     * @return RepeatedField<\Google\Rpc\Status>
     */
    public function getErrorSamples()
    {
        return $this->error_samples;
    }

    /**
     * A sample of errors encountered while indexing the document.
     * If this field is populated, the document is not indexed due to errors.
     *
     * Generated from protobuf field <code>repeated .google.rpc.Status error_samples = 2;</code>
     * @param \Google\Rpc\Status[] $var
     * @return $this
     */
    public function setErrorSamples($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class);
        $this->error_samples = $arr;

        return $this;
    }

    /**
     * Immutable. The message indicates the document index is in progress.
     * If this field is populated, the document index is pending.
     *
     * Generated from protobuf field <code>string pending_message = 3 [(.google.api.field_behavior) = IMMUTABLE];</code>
     * @return string
     */
    public function getPendingMessage()
    {
        return $this->pending_message;
    }

    /**
     * Immutable. The message indicates the document index is in progress.
     * If this field is populated, the document index is pending.
     *
     * Generated from protobuf field <code>string pending_message = 3 [(.google.api.field_behavior) = IMMUTABLE];</code>
     * @param string $var
     * @return $this
     */
    public function setPendingMessage($var)
    {
        GPBUtil::checkString($var, True);
        $this->pending_message = $var;

        return $this;
    }

}

