<?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\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * 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.
     *     @type \Google\Cloud\Dlp\V2\AdjustmentRule $adjustment_rule
     *           Adjustment 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|null
     */
    public function getHotwordRule()
    {
        return $this->readOneof(1);
    }

    public function hasHotwordRule()
    {
        return $this->hasOneof(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|null
     */
    public function getExclusionRule()
    {
        return $this->readOneof(2);
    }

    public function hasExclusionRule()
    {
        return $this->hasOneof(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;
    }

    /**
     * Adjustment rule.
     *
     * Generated from protobuf field <code>.google.privacy.dlp.v2.AdjustmentRule adjustment_rule = 3;</code>
     * @return \Google\Cloud\Dlp\V2\AdjustmentRule|null
     */
    public function getAdjustmentRule()
    {
        return $this->readOneof(3);
    }

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

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

        return $this;
    }

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

}

