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

namespace Google\Cloud\DiscoveryEngine\V1beta;

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

/**
 * Request message for
 * [DocumentService.UpdateDocument][google.cloud.discoveryengine.v1beta.DocumentService.UpdateDocument]
 * method.
 *
 * Generated from protobuf message <code>google.cloud.discoveryengine.v1beta.UpdateDocumentRequest</code>
 */
class UpdateDocumentRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The document to update/create.
     * If the caller does not have permission to update the
     * [Document][google.cloud.discoveryengine.v1beta.Document], regardless of
     * whether or not it exists, a `PERMISSION_DENIED` error is returned.
     * If the [Document][google.cloud.discoveryengine.v1beta.Document] to update
     * does not exist and
     * [allow_missing][google.cloud.discoveryengine.v1beta.UpdateDocumentRequest.allow_missing]
     * is not set, a `NOT_FOUND` error is returned.
     *
     * Generated from protobuf field <code>.google.cloud.discoveryengine.v1beta.Document document = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $document = null;
    /**
     * If set to `true` and the
     * [Document][google.cloud.discoveryengine.v1beta.Document] is not found, a
     * new [Document][google.cloud.discoveryengine.v1beta.Document] is be created.
     *
     * Generated from protobuf field <code>bool allow_missing = 2;</code>
     */
    protected $allow_missing = false;
    /**
     * Indicates which fields in the provided imported 'document' to update. If
     * not set, by default updates all fields.
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 3;</code>
     */
    protected $update_mask = null;

    /**
     * @param \Google\Cloud\DiscoveryEngine\V1beta\Document $document   Required. The document to update/create.
     *
     *                                                                  If the caller does not have permission to update the
     *                                                                  [Document][google.cloud.discoveryengine.v1beta.Document], regardless of
     *                                                                  whether or not it exists, a `PERMISSION_DENIED` error is returned.
     *
     *                                                                  If the [Document][google.cloud.discoveryengine.v1beta.Document] to update
     *                                                                  does not exist and
     *                                                                  [allow_missing][google.cloud.discoveryengine.v1beta.UpdateDocumentRequest.allow_missing]
     *                                                                  is not set, a `NOT_FOUND` error is returned.
     * @param \Google\Protobuf\FieldMask                    $updateMask Indicates which fields in the provided imported 'document' to update. If
     *                                                                  not set, by default updates all fields.
     *
     * @return \Google\Cloud\DiscoveryEngine\V1beta\UpdateDocumentRequest
     *
     * @experimental
     */
    public static function build(\Google\Cloud\DiscoveryEngine\V1beta\Document $document, \Google\Protobuf\FieldMask $updateMask): self
    {
        return (new self())
            ->setDocument($document)
            ->setUpdateMask($updateMask);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\DiscoveryEngine\V1beta\Document $document
     *           Required. The document to update/create.
     *           If the caller does not have permission to update the
     *           [Document][google.cloud.discoveryengine.v1beta.Document], regardless of
     *           whether or not it exists, a `PERMISSION_DENIED` error is returned.
     *           If the [Document][google.cloud.discoveryengine.v1beta.Document] to update
     *           does not exist and
     *           [allow_missing][google.cloud.discoveryengine.v1beta.UpdateDocumentRequest.allow_missing]
     *           is not set, a `NOT_FOUND` error is returned.
     *     @type bool $allow_missing
     *           If set to `true` and the
     *           [Document][google.cloud.discoveryengine.v1beta.Document] is not found, a
     *           new [Document][google.cloud.discoveryengine.v1beta.Document] is be created.
     *     @type \Google\Protobuf\FieldMask $update_mask
     *           Indicates which fields in the provided imported 'document' to update. If
     *           not set, by default updates all fields.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\DocumentService::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The document to update/create.
     * If the caller does not have permission to update the
     * [Document][google.cloud.discoveryengine.v1beta.Document], regardless of
     * whether or not it exists, a `PERMISSION_DENIED` error is returned.
     * If the [Document][google.cloud.discoveryengine.v1beta.Document] to update
     * does not exist and
     * [allow_missing][google.cloud.discoveryengine.v1beta.UpdateDocumentRequest.allow_missing]
     * is not set, a `NOT_FOUND` error is returned.
     *
     * Generated from protobuf field <code>.google.cloud.discoveryengine.v1beta.Document document = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\DiscoveryEngine\V1beta\Document|null
     */
    public function getDocument()
    {
        return $this->document;
    }

    public function hasDocument()
    {
        return isset($this->document);
    }

    public function clearDocument()
    {
        unset($this->document);
    }

    /**
     * Required. The document to update/create.
     * If the caller does not have permission to update the
     * [Document][google.cloud.discoveryengine.v1beta.Document], regardless of
     * whether or not it exists, a `PERMISSION_DENIED` error is returned.
     * If the [Document][google.cloud.discoveryengine.v1beta.Document] to update
     * does not exist and
     * [allow_missing][google.cloud.discoveryengine.v1beta.UpdateDocumentRequest.allow_missing]
     * is not set, a `NOT_FOUND` error is returned.
     *
     * Generated from protobuf field <code>.google.cloud.discoveryengine.v1beta.Document document = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\DiscoveryEngine\V1beta\Document $var
     * @return $this
     */
    public function setDocument($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1beta\Document::class);
        $this->document = $var;

        return $this;
    }

    /**
     * If set to `true` and the
     * [Document][google.cloud.discoveryengine.v1beta.Document] is not found, a
     * new [Document][google.cloud.discoveryengine.v1beta.Document] is be created.
     *
     * Generated from protobuf field <code>bool allow_missing = 2;</code>
     * @return bool
     */
    public function getAllowMissing()
    {
        return $this->allow_missing;
    }

    /**
     * If set to `true` and the
     * [Document][google.cloud.discoveryengine.v1beta.Document] is not found, a
     * new [Document][google.cloud.discoveryengine.v1beta.Document] is be created.
     *
     * Generated from protobuf field <code>bool allow_missing = 2;</code>
     * @param bool $var
     * @return $this
     */
    public function setAllowMissing($var)
    {
        GPBUtil::checkBool($var);
        $this->allow_missing = $var;

        return $this;
    }

    /**
     * Indicates which fields in the provided imported 'document' to update. If
     * not set, by default updates all fields.
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 3;</code>
     * @return \Google\Protobuf\FieldMask|null
     */
    public function getUpdateMask()
    {
        return $this->update_mask;
    }

    public function hasUpdateMask()
    {
        return isset($this->update_mask);
    }

    public function clearUpdateMask()
    {
        unset($this->update_mask);
    }

    /**
     * Indicates which fields in the provided imported 'document' to update. If
     * not set, by default updates all fields.
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 3;</code>
     * @param \Google\Protobuf\FieldMask $var
     * @return $this
     */
    public function setUpdateMask($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class);
        $this->update_mask = $var;

        return $this;
    }

}

