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

namespace Google\Apps\Chat\V1;

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

/**
 * Request to update a message.
 *
 * Generated from protobuf message <code>google.chat.v1.UpdateMessageRequest</code>
 */
class UpdateMessageRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. Message with fields updated.
     *
     * Generated from protobuf field <code>.google.chat.v1.Message message = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $message = null;
    /**
     * Required. The field paths to update. Separate multiple values with commas
     * or use `*` to update all field paths.
     * Currently supported field paths:
     * - `text`
     * - `attachment`
     * - `cards` (Requires [app
     * authentication](/chat/api/guides/auth/service-accounts).)
     * - `cards_v2`  (Requires [app
     * authentication](/chat/api/guides/auth/service-accounts).)
     * - `accessory_widgets`  (Requires [app
     * authentication](/chat/api/guides/auth/service-accounts).)
     * - `quoted_message_metadata` (Only allows removal of the quoted message.)
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $update_mask = null;
    /**
     * Optional. If `true` and the message isn't found, a new message is created
     * and `updateMask` is ignored. The specified message ID must be
     * [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message)
     * or the request fails.
     *
     * Generated from protobuf field <code>bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $allow_missing = false;

    /**
     * @param \Google\Apps\Chat\V1\Message $message    Required. Message with fields updated.
     * @param \Google\Protobuf\FieldMask   $updateMask Required. The field paths to update. Separate multiple values with commas
     *                                                 or use `*` to update all field paths.
     *
     *                                                 Currently supported field paths:
     *
     *                                                 - `text`
     *
     *                                                 - `attachment`
     *
     *                                                 - `cards` (Requires [app
     *                                                 authentication](/chat/api/guides/auth/service-accounts).)
     *
     *                                                 - `cards_v2`  (Requires [app
     *                                                 authentication](/chat/api/guides/auth/service-accounts).)
     *
     *                                                 - `accessory_widgets`  (Requires [app
     *                                                 authentication](/chat/api/guides/auth/service-accounts).)
     *
     *                                                 - `quoted_message_metadata` (Only allows removal of the quoted message.)
     *
     * @return \Google\Apps\Chat\V1\UpdateMessageRequest
     *
     * @experimental
     */
    public static function build(\Google\Apps\Chat\V1\Message $message, \Google\Protobuf\FieldMask $updateMask): self
    {
        return (new self())
            ->setMessage($message)
            ->setUpdateMask($updateMask);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Apps\Chat\V1\Message $message
     *           Required. Message with fields updated.
     *     @type \Google\Protobuf\FieldMask $update_mask
     *           Required. The field paths to update. Separate multiple values with commas
     *           or use `*` to update all field paths.
     *           Currently supported field paths:
     *           - `text`
     *           - `attachment`
     *           - `cards` (Requires [app
     *           authentication](/chat/api/guides/auth/service-accounts).)
     *           - `cards_v2`  (Requires [app
     *           authentication](/chat/api/guides/auth/service-accounts).)
     *           - `accessory_widgets`  (Requires [app
     *           authentication](/chat/api/guides/auth/service-accounts).)
     *           - `quoted_message_metadata` (Only allows removal of the quoted message.)
     *     @type bool $allow_missing
     *           Optional. If `true` and the message isn't found, a new message is created
     *           and `updateMask` is ignored. The specified message ID must be
     *           [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message)
     *           or the request fails.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Chat\V1\Message::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Message with fields updated.
     *
     * Generated from protobuf field <code>.google.chat.v1.Message message = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Apps\Chat\V1\Message|null
     */
    public function getMessage()
    {
        return $this->message;
    }

    public function hasMessage()
    {
        return isset($this->message);
    }

    public function clearMessage()
    {
        unset($this->message);
    }

    /**
     * Required. Message with fields updated.
     *
     * Generated from protobuf field <code>.google.chat.v1.Message message = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Apps\Chat\V1\Message $var
     * @return $this
     */
    public function setMessage($var)
    {
        GPBUtil::checkMessage($var, \Google\Apps\Chat\V1\Message::class);
        $this->message = $var;

        return $this;
    }

    /**
     * Required. The field paths to update. Separate multiple values with commas
     * or use `*` to update all field paths.
     * Currently supported field paths:
     * - `text`
     * - `attachment`
     * - `cards` (Requires [app
     * authentication](/chat/api/guides/auth/service-accounts).)
     * - `cards_v2`  (Requires [app
     * authentication](/chat/api/guides/auth/service-accounts).)
     * - `accessory_widgets`  (Requires [app
     * authentication](/chat/api/guides/auth/service-accounts).)
     * - `quoted_message_metadata` (Only allows removal of the quoted message.)
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];</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);
    }

    /**
     * Required. The field paths to update. Separate multiple values with commas
     * or use `*` to update all field paths.
     * Currently supported field paths:
     * - `text`
     * - `attachment`
     * - `cards` (Requires [app
     * authentication](/chat/api/guides/auth/service-accounts).)
     * - `cards_v2`  (Requires [app
     * authentication](/chat/api/guides/auth/service-accounts).)
     * - `accessory_widgets`  (Requires [app
     * authentication](/chat/api/guides/auth/service-accounts).)
     * - `quoted_message_metadata` (Only allows removal of the quoted message.)
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED];</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;
    }

    /**
     * Optional. If `true` and the message isn't found, a new message is created
     * and `updateMask` is ignored. The specified message ID must be
     * [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message)
     * or the request fails.
     *
     * Generated from protobuf field <code>bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return bool
     */
    public function getAllowMissing()
    {
        return $this->allow_missing;
    }

    /**
     * Optional. If `true` and the message isn't found, a new message is created
     * and `updateMask` is ignored. The specified message ID must be
     * [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message)
     * or the request fails.
     *
     * Generated from protobuf field <code>bool allow_missing = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param bool $var
     * @return $this
     */
    public function setAllowMissing($var)
    {
        GPBUtil::checkBool($var);
        $this->allow_missing = $var;

        return $this;
    }

}

