<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: keyapis/user/v1/keyapis_user_user_v1.proto

namespace Keyapis\User\V1;

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

/**
 * Идентификационный код пользователя
 *
 * Generated from protobuf message <code>keyapis.user.v1.UserCode</code>
 */
class UserCode extends \Google\Protobuf\Internal\Message
{
    /**
     * Идентификационный код.
     * Если поле не заполнено, генерируется автоматически.
     * # Диапазон: 10000..99999
     *
     * Generated from protobuf field <code>int32 code = 1;</code>
     */
    protected $code = 0;
    /**
     * Идентификатор пользователя.
     * # Диапазон: 0..2147483647
     *
     * Generated from protobuf field <code>int32 user_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $user_id = 0;
    /**
     * Дата создания.
     * # Тип: DateTime
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp created_at = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $created_at = null;
    /**
     * Идентификатор создателя кода
     *
     * Generated from protobuf field <code>int32 creator_user_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $creator_user_id = 0;
    /**
     * Тип создателя кода
     *
     * Generated from protobuf field <code>.keyapis.user.v1.User.Type creator_user_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $creator_user_type = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type int $code
     *           Идентификационный код.
     *           Если поле не заполнено, генерируется автоматически.
     *           # Диапазон: 10000..99999
     *     @type int $user_id
     *           Идентификатор пользователя.
     *           # Диапазон: 0..2147483647
     *     @type \Google\Protobuf\Timestamp $created_at
     *           Дата создания.
     *           # Тип: DateTime
     *     @type int $creator_user_id
     *           Идентификатор создателя кода
     *     @type int $creator_user_type
     *           Тип создателя кода
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Keyapis\User\V1\KeyapisUserUserV1::initOnce();
        parent::__construct($data);
    }

    /**
     * Идентификационный код.
     * Если поле не заполнено, генерируется автоматически.
     * # Диапазон: 10000..99999
     *
     * Generated from protobuf field <code>int32 code = 1;</code>
     * @return int
     */
    public function getCode()
    {
        return $this->code;
    }

    /**
     * Идентификационный код.
     * Если поле не заполнено, генерируется автоматически.
     * # Диапазон: 10000..99999
     *
     * Generated from protobuf field <code>int32 code = 1;</code>
     * @param int $var
     * @return $this
     */
    public function setCode($var)
    {
        GPBUtil::checkInt32($var);
        $this->code = $var;

        return $this;
    }

    /**
     * Идентификатор пользователя.
     * # Диапазон: 0..2147483647
     *
     * Generated from protobuf field <code>int32 user_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getUserId()
    {
        return $this->user_id;
    }

    /**
     * Идентификатор пользователя.
     * # Диапазон: 0..2147483647
     *
     * Generated from protobuf field <code>int32 user_id = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setUserId($var)
    {
        GPBUtil::checkInt32($var);
        $this->user_id = $var;

        return $this;
    }

    /**
     * Дата создания.
     * # Тип: DateTime
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp created_at = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getCreatedAt()
    {
        return $this->created_at;
    }

    public function hasCreatedAt()
    {
        return isset($this->created_at);
    }

    public function clearCreatedAt()
    {
        unset($this->created_at);
    }

    /**
     * Дата создания.
     * # Тип: DateTime
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp created_at = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setCreatedAt($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->created_at = $var;

        return $this;
    }

    /**
     * Идентификатор создателя кода
     *
     * Generated from protobuf field <code>int32 creator_user_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getCreatorUserId()
    {
        return $this->creator_user_id;
    }

    /**
     * Идентификатор создателя кода
     *
     * Generated from protobuf field <code>int32 creator_user_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setCreatorUserId($var)
    {
        GPBUtil::checkInt32($var);
        $this->creator_user_id = $var;

        return $this;
    }

    /**
     * Тип создателя кода
     *
     * Generated from protobuf field <code>.keyapis.user.v1.User.Type creator_user_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return int
     */
    public function getCreatorUserType()
    {
        return $this->creator_user_type;
    }

    /**
     * Тип создателя кода
     *
     * Generated from protobuf field <code>.keyapis.user.v1.User.Type creator_user_type = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param int $var
     * @return $this
     */
    public function setCreatorUserType($var)
    {
        GPBUtil::checkEnum($var, \Keyapis\User\V1\User\Type::class);
        $this->creator_user_type = $var;

        return $this;
    }

}

