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

namespace Google\Cloud\ArtifactRegistry\V1;

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

/**
 * The request to update a rule.
 *
 * Generated from protobuf message <code>google.devtools.artifactregistry.v1.UpdateRuleRequest</code>
 */
class UpdateRuleRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * The rule that replaces the resource on the server.
     *
     * Generated from protobuf field <code>.google.devtools.artifactregistry.v1.Rule rule = 1;</code>
     */
    protected $rule = null;
    /**
     * The update mask applies to the resource. For the `FieldMask` definition,
     * see
     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 2;</code>
     */
    protected $update_mask = null;

    /**
     * @param \Google\Cloud\ArtifactRegistry\V1\Rule $rule       The rule that replaces the resource on the server.
     * @param \Google\Protobuf\FieldMask             $updateMask The update mask applies to the resource. For the `FieldMask` definition,
     *                                                           see
     *                                                           https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
     *
     * @return \Google\Cloud\ArtifactRegistry\V1\UpdateRuleRequest
     *
     * @experimental
     */
    public static function build(\Google\Cloud\ArtifactRegistry\V1\Rule $rule, \Google\Protobuf\FieldMask $updateMask): self
    {
        return (new self())
            ->setRule($rule)
            ->setUpdateMask($updateMask);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\ArtifactRegistry\V1\Rule $rule
     *           The rule that replaces the resource on the server.
     *     @type \Google\Protobuf\FieldMask $update_mask
     *           The update mask applies to the resource. For the `FieldMask` definition,
     *           see
     *           https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Devtools\Artifactregistry\V1\Rule::initOnce();
        parent::__construct($data);
    }

    /**
     * The rule that replaces the resource on the server.
     *
     * Generated from protobuf field <code>.google.devtools.artifactregistry.v1.Rule rule = 1;</code>
     * @return \Google\Cloud\ArtifactRegistry\V1\Rule|null
     */
    public function getRule()
    {
        return $this->rule;
    }

    public function hasRule()
    {
        return isset($this->rule);
    }

    public function clearRule()
    {
        unset($this->rule);
    }

    /**
     * The rule that replaces the resource on the server.
     *
     * Generated from protobuf field <code>.google.devtools.artifactregistry.v1.Rule rule = 1;</code>
     * @param \Google\Cloud\ArtifactRegistry\V1\Rule $var
     * @return $this
     */
    public function setRule($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\ArtifactRegistry\V1\Rule::class);
        $this->rule = $var;

        return $this;
    }

    /**
     * The update mask applies to the resource. For the `FieldMask` definition,
     * see
     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 2;</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);
    }

    /**
     * The update mask applies to the resource. For the `FieldMask` definition,
     * see
     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
     *
     * Generated from protobuf field <code>.google.protobuf.FieldMask update_mask = 2;</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;
    }

}

