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

namespace Google\Cloud\Asset\V1\AnalyzerOrgPolicy;

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

/**
 * Represents a rule defined in an organization policy
 *
 * Generated from protobuf message <code>google.cloud.asset.v1.AnalyzerOrgPolicy.Rule</code>
 */
class Rule extends \Google\Protobuf\Internal\Message
{
    /**
     * The evaluating condition for this rule.
     *
     * Generated from protobuf field <code>.google.type.Expr condition = 7;</code>
     */
    private $condition = null;
    protected $kind;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Asset\V1\AnalyzerOrgPolicy\Rule\StringValues $values
     *           List of values to be used for this PolicyRule. This field can be set
     *           only in Policies for list constraints.
     *     @type bool $allow_all
     *           Setting this to true means that all values are allowed. This field can
     *           be set only in Policies for list constraints.
     *     @type bool $deny_all
     *           Setting this to true means that all values are denied. This field can
     *           be set only in Policies for list constraints.
     *     @type bool $enforce
     *           If `true`, then the `Policy` is enforced. If `false`, then any
     *           configuration is acceptable.
     *           This field can be set only in Policies for boolean constraints.
     *     @type \Google\Type\Expr $condition
     *           The evaluating condition for this rule.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce();
        parent::__construct($data);
    }

    /**
     * List of values to be used for this PolicyRule. This field can be set
     * only in Policies for list constraints.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.StringValues values = 3;</code>
     * @return \Google\Cloud\Asset\V1\AnalyzerOrgPolicy\Rule\StringValues|null
     */
    public function getValues()
    {
        return $this->readOneof(3);
    }

    public function hasValues()
    {
        return $this->hasOneof(3);
    }

    /**
     * List of values to be used for this PolicyRule. This field can be set
     * only in Policies for list constraints.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicy.Rule.StringValues values = 3;</code>
     * @param \Google\Cloud\Asset\V1\AnalyzerOrgPolicy\Rule\StringValues $var
     * @return $this
     */
    public function setValues($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Asset\V1\AnalyzerOrgPolicy\Rule\StringValues::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * Setting this to true means that all values are allowed. This field can
     * be set only in Policies for list constraints.
     *
     * Generated from protobuf field <code>bool allow_all = 4;</code>
     * @return bool
     */
    public function getAllowAll()
    {
        return $this->readOneof(4);
    }

    public function hasAllowAll()
    {
        return $this->hasOneof(4);
    }

    /**
     * Setting this to true means that all values are allowed. This field can
     * be set only in Policies for list constraints.
     *
     * Generated from protobuf field <code>bool allow_all = 4;</code>
     * @param bool $var
     * @return $this
     */
    public function setAllowAll($var)
    {
        GPBUtil::checkBool($var);
        $this->writeOneof(4, $var);

        return $this;
    }

    /**
     * Setting this to true means that all values are denied. This field can
     * be set only in Policies for list constraints.
     *
     * Generated from protobuf field <code>bool deny_all = 5;</code>
     * @return bool
     */
    public function getDenyAll()
    {
        return $this->readOneof(5);
    }

    public function hasDenyAll()
    {
        return $this->hasOneof(5);
    }

    /**
     * Setting this to true means that all values are denied. This field can
     * be set only in Policies for list constraints.
     *
     * Generated from protobuf field <code>bool deny_all = 5;</code>
     * @param bool $var
     * @return $this
     */
    public function setDenyAll($var)
    {
        GPBUtil::checkBool($var);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * If `true`, then the `Policy` is enforced. If `false`, then any
     * configuration is acceptable.
     * This field can be set only in Policies for boolean constraints.
     *
     * Generated from protobuf field <code>bool enforce = 6;</code>
     * @return bool
     */
    public function getEnforce()
    {
        return $this->readOneof(6);
    }

    public function hasEnforce()
    {
        return $this->hasOneof(6);
    }

    /**
     * If `true`, then the `Policy` is enforced. If `false`, then any
     * configuration is acceptable.
     * This field can be set only in Policies for boolean constraints.
     *
     * Generated from protobuf field <code>bool enforce = 6;</code>
     * @param bool $var
     * @return $this
     */
    public function setEnforce($var)
    {
        GPBUtil::checkBool($var);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * The evaluating condition for this rule.
     *
     * Generated from protobuf field <code>.google.type.Expr condition = 7;</code>
     * @return \Google\Type\Expr|null
     */
    public function getCondition()
    {
        return $this->condition;
    }

    public function hasCondition()
    {
        return isset($this->condition);
    }

    public function clearCondition()
    {
        unset($this->condition);
    }

    /**
     * The evaluating condition for this rule.
     *
     * Generated from protobuf field <code>.google.type.Expr condition = 7;</code>
     * @param \Google\Type\Expr $var
     * @return $this
     */
    public function setCondition($var)
    {
        GPBUtil::checkMessage($var, \Google\Type\Expr::class);
        $this->condition = $var;

        return $this;
    }

    /**
     * @return string
     */
    public function getKind()
    {
        return $this->whichOneof("kind");
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(Rule::class, \Google\Cloud\Asset\V1\AnalyzerOrgPolicy_Rule::class);

