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

/**
 * Generated from protobuf message <code>google.cloud.recaptchaenterprise.v1.TokenProperties</code>
 */
class TokenProperties extends \Google\Protobuf\Internal\Message
{
    /**
     * 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;</code>
     */
    private $valid = false;
    /**
     * Reason associated with the response when valid = false.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason invalid_reason = 2;</code>
     */
    private $invalid_reason = 0;
    /**
     * The timestamp corresponding to the generation of the token.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3;</code>
     */
    private $create_time = null;
    /**
     * The hostname of the page on which the token was generated (Web keys only).
     *
     * Generated from protobuf field <code>string hostname = 4;</code>
     */
    private $hostname = '';
    /**
     * 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;</code>
     */
    private $android_package_name = '';
    /**
     * 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;</code>
     */
    private $ios_bundle_id = '';
    /**
     * Action name provided at token generation.
     *
     * Generated from protobuf field <code>string action = 5;</code>
     */
    private $action = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type bool $valid
     *           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
     *           Reason associated with the response when valid = false.
     *     @type \Google\Protobuf\Timestamp $create_time
     *           The timestamp corresponding to the generation of the token.
     *     @type string $hostname
     *           The hostname of the page on which the token was generated (Web keys only).
     *     @type string $android_package_name
     *           The name of the Android package with which the token was generated (Android
     *           keys only).
     *     @type string $ios_bundle_id
     *           The ID of the iOS bundle with which the token was generated (iOS keys
     *           only).
     *     @type string $action
     *           Action name provided at token generation.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce();
        parent::__construct($data);
    }

    /**
     * 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;</code>
     * @return bool
     */
    public function getValid()
    {
        return $this->valid;
    }

    /**
     * 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;</code>
     * @param bool $var
     * @return $this
     */
    public function setValid($var)
    {
        GPBUtil::checkBool($var);
        $this->valid = $var;

        return $this;
    }

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

    /**
     * Reason associated with the response when valid = false.
     *
     * Generated from protobuf field <code>.google.cloud.recaptchaenterprise.v1.TokenProperties.InvalidReason invalid_reason = 2;</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;
    }

    /**
     * The timestamp corresponding to the generation of the token.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3;</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);
    }

    /**
     * The timestamp corresponding to the generation of the token.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 3;</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;
    }

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

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

        return $this;
    }

    /**
     * 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;</code>
     * @return string
     */
    public function getAndroidPackageName()
    {
        return $this->android_package_name;
    }

    /**
     * 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;</code>
     * @param string $var
     * @return $this
     */
    public function setAndroidPackageName($var)
    {
        GPBUtil::checkString($var, True);
        $this->android_package_name = $var;

        return $this;
    }

    /**
     * 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;</code>
     * @return string
     */
    public function getIosBundleId()
    {
        return $this->ios_bundle_id;
    }

    /**
     * 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;</code>
     * @param string $var
     * @return $this
     */
    public function setIosBundleId($var)
    {
        GPBUtil::checkString($var, True);
        $this->ios_bundle_id = $var;

        return $this;
    }

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

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

        return $this;
    }

}

