<?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 identifier associated with a user.
 *
 * Generated from protobuf message <code>google.cloud.recaptchaenterprise.v1.UserId</code>
 */
class UserId extends \Google\Protobuf\Internal\Message
{
    protected $id_oneof;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $email
     *           Optional. An email address.
     *     @type string $phone_number
     *           Optional. A phone number. Should use the E.164 format.
     *     @type string $username
     *           Optional. A unique username, if different from all the other identifiers
     *           and `account_id` that are provided. Can be a unique login handle or
     *           display name for a user.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Recaptchaenterprise\V1\Recaptchaenterprise::initOnce();
        parent::__construct($data);
    }

    /**
     * Optional. An email address.
     *
     * Generated from protobuf field <code>string email = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getEmail()
    {
        return $this->readOneof(1);
    }

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

    /**
     * Optional. An email address.
     *
     * Generated from protobuf field <code>string email = 1 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setEmail($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Optional. A phone number. Should use the E.164 format.
     *
     * Generated from protobuf field <code>string phone_number = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getPhoneNumber()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Optional. A phone number. Should use the E.164 format.
     *
     * Generated from protobuf field <code>string phone_number = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setPhoneNumber($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Optional. A unique username, if different from all the other identifiers
     * and `account_id` that are provided. Can be a unique login handle or
     * display name for a user.
     *
     * Generated from protobuf field <code>string username = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getUsername()
    {
        return $this->readOneof(3);
    }

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

    /**
     * Optional. A unique username, if different from all the other identifiers
     * and `account_id` that are provided. Can be a unique login handle or
     * display name for a user.
     *
     * Generated from protobuf field <code>string username = 3 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setUsername($var)
    {
        GPBUtil::checkString($var, True);
        $this->writeOneof(3, $var);

        return $this;
    }

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

}

