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

/**
 * Properties of the provided event token.
 *
 * Generated from protobuf message <code>google.cloud.recaptchaenterprise.v1.TokenProperties</code>
 */
class TokenProperties extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. Whether the provided user response token is valid. When valid
     * = false, the reason could be specified in invalid_reason or it could also
     * be due to a user failing to solve a challenge or a sitekey mismatch (i.e
     * the sitekey used to generate the token was different than the one specified
     * in the assessment).
     *
     * Generated from protobuf field <code>bool valid = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $valid = false;
    /**
     * Output only. Reason associated with the response when valid = false.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason invalid_reason = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $invalid_reason = 0;
    /**
     * Output only. The timestamp corresponding to the generation of the token.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $create_time = null;
    /**
     * Output only. The hostname of the page on which the token was generated (Web
     * keys only).
     *
     * Generated from protobuf field <code>string hostname = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $hostname = '';
    /**
     * Output only. The name of the Android package with which the token was
     * generated (Android keys only).
     *
     * Generated from protobuf field <code>string android_package_name = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $android_package_name = '';
    /**
     * Output only. The ID of the iOS bundle with which the token was generated
     * (iOS keys only).
     *
     * Generated from protobuf field <code>string ios_bundle_id = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $ios_bundle_id = '';
    /**
     * Output only. Action name provided at token generation.
     *
     * Generated from protobuf field <code>string action = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $action = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type bool $valid
     *           Output only. Whether the provided user response token is valid. When valid
     *           = false, the reason could be specified in invalid_reason or it could also
     *           be due to a user failing to solve a challenge or a sitekey mismatch (i.e
     *           the sitekey used to generate the token was different than the one specified
     *           in the assessment).
     *     @type int $invalid_reason
     *           Output only. Reason associated with the response when valid = false.
     *     @type \Google\Protobuf\Timestamp $create_time
     *           Output only. The timestamp corresponding to the generation of the token.
     *     @type string $hostname
     *           Output only. The hostname of the page on which the token was generated (Web
     *           keys only).
     *     @type string $android_package_name
     *           Output only. The name of the Android package with which the token was
     *           generated (Android keys only).
     *     @type string $ios_bundle_id
     *           Output only. The ID of the iOS bundle with which the token was generated
     *           (iOS keys only).
     *     @type string $action
     *           Output only. Action name provided at token generation.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce();
        parent::__construct($data);
    }

    /**
     * Output only. Whether the provided user response token is valid. When valid
     * = false, the reason could be specified in invalid_reason or it could also
     * be due to a user failing to solve a challenge or a sitekey mismatch (i.e
     * the sitekey used to generate the token was different than the one specified
     * in the assessment).
     *
     * Generated from protobuf field <code>bool valid = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return bool
     */
    public function getValid()
    {
        return $this->valid;
    }

    /**
     * Output only. Whether the provided user response token is valid. When valid
     * = false, the reason could be specified in invalid_reason or it could also
     * be due to a user failing to solve a challenge or a sitekey mismatch (i.e
     * the sitekey used to generate the token was different than the one specified
     * in the assessment).
     *
     * Generated from protobuf field <code>bool valid = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param bool $var
     * @return $this
     */
    public function setValid($var)
    {
        GPBUtil::checkBool($var);
        $this->valid = $var;

        return $this;
    }

    /**
     * Output only. Reason associated with the response when valid = false.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason invalid_reason = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getInvalidReason()
    {
        return $this->invalid_reason;
    }

    /**
     * Output only. Reason associated with the response when valid = false.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason invalid_reason = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setInvalidReason($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\RecaptchaEnterprise\V1\TokenProperties\InvalidReason::class);
        $this->invalid_reason = $var;

        return $this;
    }

    /**
     * Output only. The timestamp corresponding to the generation of the token.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreateTime()
    {
        return $this->create_time;
    }

    public function hasCreateTime()
    {
        return isset($this->create_time);
    }

    public function clearCreateTime()
    {
        unset($this->create_time);
    }

    /**
     * Output only. The timestamp corresponding to the generation of the token.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCreateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->create_time = $var;

        return $this;
    }

    /**
     * Output only. The hostname of the page on which the token was generated (Web
     * keys only).
     *
     * Generated from protobuf field <code>string hostname = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getHostname()
    {
        return $this->hostname;
    }

    /**
     * Output only. The hostname of the page on which the token was generated (Web
     * keys only).
     *
     * Generated from protobuf field <code>string hostname = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setHostname($var)
    {
        GPBUtil::checkString($var, True);
        $this->hostname = $var;

        return $this;
    }

    /**
     * Output only. The name of the Android package with which the token was
     * generated (Android keys only).
     *
     * Generated from protobuf field <code>string android_package_name = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getAndroidPackageName()
    {
        return $this->android_package_name;
    }

    /**
     * Output only. The name of the Android package with which the token was
     * generated (Android keys only).
     *
     * Generated from protobuf field <code>string android_package_name = 8 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setAndroidPackageName($var)
    {
        GPBUtil::checkString($var, True);
        $this->android_package_name = $var;

        return $this;
    }

    /**
     * Output only. The ID of the iOS bundle with which the token was generated
     * (iOS keys only).
     *
     * Generated from protobuf field <code>string ios_bundle_id = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getIosBundleId()
    {
        return $this->ios_bundle_id;
    }

    /**
     * Output only. The ID of the iOS bundle with which the token was generated
     * (iOS keys only).
     *
     * Generated from protobuf field <code>string ios_bundle_id = 9 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setIosBundleId($var)
    {
        GPBUtil::checkString($var, True);
        $this->ios_bundle_id = $var;

        return $this;
    }

    /**
     * Output only. Action name provided at token generation.
     *
     * Generated from protobuf field <code>string action = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getAction()
    {
        return $this->action;
    }

    /**
     * Output only. Action name provided at token generation.
     *
     * Generated from protobuf field <code>string action = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setAction($var)
    {
        GPBUtil::checkString($var, True);
        $this->action = $var;

        return $this;
    }

}

