<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/privacy/dlp/v2/dlp.proto

namespace Google\Cloud\Dlp\V2;

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

/**
 * The rule that specifies conditions when findings of infoTypes specified in
 * `InspectionRuleSet` are removed from results.
 *
 * Generated from protobuf message <code>google.privacy.dlp.v2.ExclusionRule</code>
 */
class ExclusionRule extends \Google\Protobuf\Internal\Message
{
    /**
     * How the rule is applied, see MatchingType documentation for details.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.MatchingType matching_type = 4;</code>
     */
    private $matching_type = 0;
    protected $type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Dlp\V2\CustomInfoType\Dictionary $dictionary
     *           Dictionary which defines the rule.
     *     @type \Google\Cloud\Dlp\V2\CustomInfoType\Regex $regex
     *           Regular expression which defines the rule.
     *     @type \Google\Cloud\Dlp\V2\ExcludeInfoTypes $exclude_info_types
     *           Set of infoTypes for which findings would affect this rule.
     *     @type int $matching_type
     *           How the rule is applied, see MatchingType documentation for details.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Privacy\Dlp\V2\Dlp::initOnce();
        parent::__construct($data);
    }

    /**
     * Dictionary which defines the rule.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.CustomInfoType.Dictionary dictionary = 1;</code>
     * @return \Google\Cloud\Dlp\V2\CustomInfoType\Dictionary
     */
    public function getDictionary()
    {
        return $this->readOneof(1);
    }

    /**
     * Dictionary which defines the rule.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.CustomInfoType.Dictionary dictionary = 1;</code>
     * @param \Google\Cloud\Dlp\V2\CustomInfoType\Dictionary $var
     * @return $this
     */
    public function setDictionary($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CustomInfoType_Dictionary::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Regular expression which defines the rule.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.CustomInfoType.Regex regex = 2;</code>
     * @return \Google\Cloud\Dlp\V2\CustomInfoType\Regex
     */
    public function getRegex()
    {
        return $this->readOneof(2);
    }

    /**
     * Regular expression which defines the rule.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.CustomInfoType.Regex regex = 2;</code>
     * @param \Google\Cloud\Dlp\V2\CustomInfoType\Regex $var
     * @return $this
     */
    public function setRegex($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CustomInfoType_Regex::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Set of infoTypes for which findings would affect this rule.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.ExcludeInfoTypes exclude_info_types = 3;</code>
     * @return \Google\Cloud\Dlp\V2\ExcludeInfoTypes
     */
    public function getExcludeInfoTypes()
    {
        return $this->readOneof(3);
    }

    /**
     * Set of infoTypes for which findings would affect this rule.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.ExcludeInfoTypes exclude_info_types = 3;</code>
     * @param \Google\Cloud\Dlp\V2\ExcludeInfoTypes $var
     * @return $this
     */
    public function setExcludeInfoTypes($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\ExcludeInfoTypes::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * How the rule is applied, see MatchingType documentation for details.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.MatchingType matching_type = 4;</code>
     * @return int
     */
    public function getMatchingType()
    {
        return $this->matching_type;
    }

    /**
     * How the rule is applied, see MatchingType documentation for details.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.MatchingType matching_type = 4;</code>
     * @param int $var
     * @return $this
     */
    public function setMatchingType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Dlp\V2\MatchingType::class);
        $this->matching_type = $var;

        return $this;
    }

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

}

