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

namespace Google\Cloud\RecaptchaEnterprise\V1;

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

/**
 * An individual action. Each action represents what to do if a policy
 * matches.
 *
 * Generated from protobuf message <code>google.cloud.recaptchaenterprise.v1.FirewallAction</code>
 */
class FirewallAction extends \Google\Protobuf\Internal\Message
{
    protected $firewall_action_oneof;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\AllowAction $allow
     *           The user request did not match any policy and should be allowed
     *           access to the requested resource.
     *     @type \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\BlockAction $block
     *           This action denies access to a given page. The user gets an HTTP
     *           error code.
     *     @type \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\IncludeRecaptchaScriptAction $include_recaptcha_script
     *           This action injects reCAPTCHA JavaScript code into the HTML page
     *           returned by the site backend.
     *     @type \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\RedirectAction $redirect
     *           This action redirects the request to a reCAPTCHA interstitial to
     *           attach a token.
     *     @type \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\SubstituteAction $substitute
     *           This action transparently serves a different page to an offending
     *           user.
     *     @type \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\SetHeaderAction $set_header
     *           This action sets a custom header but allow the request to continue
     *           to the customer backend.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce();
        parent::__construct($data);
    }

    /**
     * The user request did not match any policy and should be allowed
     * access to the requested resource.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.AllowAction allow = 1;</code>
     * @return \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\AllowAction|null
     */
    public function getAllow()
    {
        return $this->readOneof(1);
    }

    public function hasAllow()
    {
        return $this->hasOneof(1);
    }

    /**
     * The user request did not match any policy and should be allowed
     * access to the requested resource.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.AllowAction allow = 1;</code>
     * @param \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\AllowAction $var
     * @return $this
     */
    public function setAllow($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\AllowAction::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * This action denies access to a given page. The user gets an HTTP
     * error code.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.BlockAction block = 2;</code>
     * @return \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\BlockAction|null
     */
    public function getBlock()
    {
        return $this->readOneof(2);
    }

    public function hasBlock()
    {
        return $this->hasOneof(2);
    }

    /**
     * This action denies access to a given page. The user gets an HTTP
     * error code.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.BlockAction block = 2;</code>
     * @param \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\BlockAction $var
     * @return $this
     */
    public function setBlock($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\BlockAction::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * This action injects reCAPTCHA JavaScript code into the HTML page
     * returned by the site backend.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.IncludeRecaptchaScriptAction include_recaptcha_script = 6;</code>
     * @return \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\IncludeRecaptchaScriptAction|null
     */
    public function getIncludeRecaptchaScript()
    {
        return $this->readOneof(6);
    }

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

    /**
     * This action injects reCAPTCHA JavaScript code into the HTML page
     * returned by the site backend.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.IncludeRecaptchaScriptAction include_recaptcha_script = 6;</code>
     * @param \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\IncludeRecaptchaScriptAction $var
     * @return $this
     */
    public function setIncludeRecaptchaScript($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\IncludeRecaptchaScriptAction::class);
        $this->writeOneof(6, $var);

        return $this;
    }

    /**
     * This action redirects the request to a reCAPTCHA interstitial to
     * attach a token.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.RedirectAction redirect = 5;</code>
     * @return \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\RedirectAction|null
     */
    public function getRedirect()
    {
        return $this->readOneof(5);
    }

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

    /**
     * This action redirects the request to a reCAPTCHA interstitial to
     * attach a token.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.RedirectAction redirect = 5;</code>
     * @param \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\RedirectAction $var
     * @return $this
     */
    public function setRedirect($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\RedirectAction::class);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * This action transparently serves a different page to an offending
     * user.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.SubstituteAction substitute = 3;</code>
     * @return \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\SubstituteAction|null
     */
    public function getSubstitute()
    {
        return $this->readOneof(3);
    }

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

    /**
     * This action transparently serves a different page to an offending
     * user.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.SubstituteAction substitute = 3;</code>
     * @param \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\SubstituteAction $var
     * @return $this
     */
    public function setSubstitute($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\SubstituteAction::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * This action sets a custom header but allow the request to continue
     * to the customer backend.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.SetHeaderAction set_header = 4;</code>
     * @return \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\SetHeaderAction|null
     */
    public function getSetHeader()
    {
        return $this->readOneof(4);
    }

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

    /**
     * This action sets a custom header but allow the request to continue
     * to the customer backend.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.FirewallAction.SetHeaderAction set_header = 4;</code>
     * @param \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\SetHeaderAction $var
     * @return $this
     */
    public function setSetHeader($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\RecaptchaEnterprise\V1\FirewallAction\SetHeaderAction::class);
        $this->writeOneof(4, $var);

        return $this;
    }

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

}

