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

namespace Google\Cloud\Firestore\Admin\V1;

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

/**
 * A Cloud Firestore User Creds.
 *
 * Generated from protobuf message <code>google.firestore.admin.v1.UserCreds</code>
 */
class UserCreds extends \Google\Protobuf\Internal\Message
{
    /**
     * Identifier. The resource name of the UserCreds.
     * Format:
     * `projects/{project}/databases/{database}/userCreds/{user_creds}`
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = IDENTIFIER];</code>
     */
    private $name = '';
    /**
     * Output only. The time the user creds were created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $create_time = null;
    /**
     * Output only. The time the user creds were last updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $update_time = null;
    /**
     * Output only. Whether the user creds are enabled or disabled. Defaults to
     * ENABLED on creation.
     *
     * Generated from protobuf field <code>.google.firestore.admin.v1.UserCreds.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $state = 0;
    /**
     * Output only. The plaintext server-generated password for the user creds.
     * Only populated in responses for CreateUserCreds and ResetUserPassword.
     *
     * Generated from protobuf field <code>string secure_password = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    private $secure_password = '';
    protected $UserCredsIdentity;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Identifier. The resource name of the UserCreds.
     *           Format:
     *           `projects/{project}/databases/{database}/userCreds/{user_creds}`
     *     @type \Google\Protobuf\Timestamp $create_time
     *           Output only. The time the user creds were created.
     *     @type \Google\Protobuf\Timestamp $update_time
     *           Output only. The time the user creds were last updated.
     *     @type int $state
     *           Output only. Whether the user creds are enabled or disabled. Defaults to
     *           ENABLED on creation.
     *     @type string $secure_password
     *           Output only. The plaintext server-generated password for the user creds.
     *           Only populated in responses for CreateUserCreds and ResetUserPassword.
     *     @type \Google\Cloud\Firestore\Admin\V1\UserCreds\ResourceIdentity $resource_identity
     *           Resource Identity descriptor.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Firestore\Admin\V1\UserCreds::initOnce();
        parent::__construct($data);
    }

    /**
     * Identifier. The resource name of the UserCreds.
     * Format:
     * `projects/{project}/databases/{database}/userCreds/{user_creds}`
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = IDENTIFIER];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Identifier. The resource name of the UserCreds.
     * Format:
     * `projects/{project}/databases/{database}/userCreds/{user_creds}`
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = IDENTIFIER];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Output only. The time the user creds were created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 2 [(.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 time the user creds were created.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp create_time = 2 [(.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 time the user creds were last updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getUpdateTime()
    {
        return $this->update_time;
    }

    public function hasUpdateTime()
    {
        return isset($this->update_time);
    }

    public function clearUpdateTime()
    {
        unset($this->update_time);
    }

    /**
     * Output only. The time the user creds were last updated.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setUpdateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->update_time = $var;

        return $this;
    }

    /**
     * Output only. Whether the user creds are enabled or disabled. Defaults to
     * ENABLED on creation.
     *
     * Generated from protobuf field <code>.google.firestore.admin.v1.UserCreds.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getState()
    {
        return $this->state;
    }

    /**
     * Output only. Whether the user creds are enabled or disabled. Defaults to
     * ENABLED on creation.
     *
     * Generated from protobuf field <code>.google.firestore.admin.v1.UserCreds.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Firestore\Admin\V1\UserCreds\State::class);
        $this->state = $var;

        return $this;
    }

    /**
     * Output only. The plaintext server-generated password for the user creds.
     * Only populated in responses for CreateUserCreds and ResetUserPassword.
     *
     * Generated from protobuf field <code>string secure_password = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getSecurePassword()
    {
        return $this->secure_password;
    }

    /**
     * Output only. The plaintext server-generated password for the user creds.
     * Only populated in responses for CreateUserCreds and ResetUserPassword.
     *
     * Generated from protobuf field <code>string secure_password = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setSecurePassword($var)
    {
        GPBUtil::checkString($var, True);
        $this->secure_password = $var;

        return $this;
    }

    /**
     * Resource Identity descriptor.
     *
     * Generated from protobuf field <code>.google.firestore.admin.v1.UserCreds.ResourceIdentity resource_identity = 6;</code>
     * @return \Google\Cloud\Firestore\Admin\V1\UserCreds\ResourceIdentity|null
     */
    public function getResourceIdentity()
    {
        return $this->readOneof(6);
    }

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

    /**
     * Resource Identity descriptor.
     *
     * Generated from protobuf field <code>.google.firestore.admin.v1.UserCreds.ResourceIdentity resource_identity = 6;</code>
     * @param \Google\Cloud\Firestore\Admin\V1\UserCreds\ResourceIdentity $var
     * @return $this
     */
    public function setResourceIdentity($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Firestore\Admin\V1\UserCreds\ResourceIdentity::class);
        $this->writeOneof(6, $var);

        return $this;
    }

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

}

