<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: temporal/api/workflowservice/v1/request_response.proto

namespace Temporal\Api\Workflowservice\V1\UpdateWorkerVersioningRulesRequest;

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

/**
 * Replaces the assignment rule at a given index.
 *
 * Generated from protobuf message <code>temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest.ReplaceBuildIdAssignmentRule</code>
 */
class ReplaceBuildIdAssignmentRule extends \Google\Protobuf\Internal\Message
{
    /**
     * Generated from protobuf field <code>int32 rule_index = 1;</code>
     */
    protected $rule_index = 0;
    /**
     * Generated from protobuf field <code>.temporal.api.taskqueue.v1.BuildIdAssignmentRule rule = 2;</code>
     */
    protected $rule = null;
    /**
     * By default presence of one unconditional rule is enforced, otherwise
     * the replace operation will be rejected. Set `force` to true to
     * bypass this validation. An unconditional assignment rule:
     *   - Has no hint filter
     *   - Has no ramp
     *
     * Generated from protobuf field <code>bool force = 3;</code>
     */
    protected $force = false;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $rule_index
     *     @type \Temporal\Api\Taskqueue\V1\BuildIdAssignmentRule $rule
     *     @type bool $force
     *           By default presence of one unconditional rule is enforced, otherwise
     *           the replace operation will be rejected. Set `force` to true to
     *           bypass this validation. An unconditional assignment rule:
     *             - Has no hint filter
     *             - Has no ramp
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Temporal\Api\Workflowservice\V1\RequestResponse::initOnce();
        parent::__construct($data);
    }

    /**
     * Generated from protobuf field <code>int32 rule_index = 1;</code>
     * @return int
     */
    public function getRuleIndex()
    {
        return $this->rule_index;
    }

    /**
     * Generated from protobuf field <code>int32 rule_index = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setRuleIndex($var)
    {
        GPBUtil::checkInt32($var);
        $this->rule_index = $var;

        return $this;
    }

    /**
     * Generated from protobuf field <code>.temporal.api.taskqueue.v1.BuildIdAssignmentRule rule = 2;</code>
     * @return \Temporal\Api\Taskqueue\V1\BuildIdAssignmentRule|null
     */
    public function getRule()
    {
        return $this->rule;
    }

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

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

    /**
     * Generated from protobuf field <code>.temporal.api.taskqueue.v1.BuildIdAssignmentRule rule = 2;</code>
     * @param \Temporal\Api\Taskqueue\V1\BuildIdAssignmentRule $var
     * @return $this
     */
    public function setRule($var)
    {
        GPBUtil::checkMessage($var, \Temporal\Api\Taskqueue\V1\BuildIdAssignmentRule::class);
        $this->rule = $var;

        return $this;
    }

    /**
     * By default presence of one unconditional rule is enforced, otherwise
     * the replace operation will be rejected. Set `force` to true to
     * bypass this validation. An unconditional assignment rule:
     *   - Has no hint filter
     *   - Has no ramp
     *
     * Generated from protobuf field <code>bool force = 3;</code>
     * @return bool
     */
    public function getForce()
    {
        return $this->force;
    }

    /**
     * By default presence of one unconditional rule is enforced, otherwise
     * the replace operation will be rejected. Set `force` to true to
     * bypass this validation. An unconditional assignment rule:
     *   - Has no hint filter
     *   - Has no ramp
     *
     * Generated from protobuf field <code>bool force = 3;</code>
     * @param bool $var
     * @return $this
     */
    public function setForce($var)
    {
        GPBUtil::checkBool($var);
        $this->force = $var;

        return $this;
    }

}

