<?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;

/**
 * A single inspection rule to be applied to infoTypes, specified in
 * `InspectionRuleSet`.
 *
 * Generated from protobuf message <code>google.privacy.dlp.v2.InspectionRule</code>
 */
class InspectionRule extends \Google\Protobuf\Internal\Message
{
    protected $type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Dlp\V2\CustomInfoType\DetectionRule\HotwordRule $hotword_rule
     *           Hotword-based detection rule.
     *     @type \Google\Cloud\Dlp\V2\ExclusionRule $exclusion_rule
     *           Exclusion rule.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Privacy\Dlp\V2\Dlp::initOnce();
        parent::__construct($data);
    }

    /**
     * Hotword-based detection rule.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.CustomInfoType.DetectionRule.HotwordRule hotword_rule = 1;</code>
     * @return \Google\Cloud\Dlp\V2\CustomInfoType\DetectionRule\HotwordRule
     */
    public function getHotwordRule()
    {
        return $this->readOneof(1);
    }

    /**
     * Hotword-based detection rule.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.CustomInfoType.DetectionRule.HotwordRule hotword_rule = 1;</code>
     * @param \Google\Cloud\Dlp\V2\CustomInfoType\DetectionRule\HotwordRule $var
     * @return $this
     */
    public function setHotwordRule($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\CustomInfoType_DetectionRule_HotwordRule::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Exclusion rule.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.ExclusionRule exclusion_rule = 2;</code>
     * @return \Google\Cloud\Dlp\V2\ExclusionRule
     */
    public function getExclusionRule()
    {
        return $this->readOneof(2);
    }

    /**
     * Exclusion rule.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.ExclusionRule exclusion_rule = 2;</code>
     * @param \Google\Cloud\Dlp\V2\ExclusionRule $var
     * @return $this
     */
    public function setExclusionRule($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Dlp\V2\ExclusionRule::class);
        $this->writeOneof(2, $var);

        return $this;
    }

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

}

