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

namespace Keyapis\Identity\V1;

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

/**
 * Ошибки сервисов ключа
 *
 * Generated from protobuf message <code>keyapis.identity.v1.KeyError</code>
 */
class KeyError extends \Google\Protobuf\Internal\Message
{
    protected $reason;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Keyapis\Identity\V1\KeyError\UserCreation $user_creation
     *           Ошибка создания пользователя
     *     @type \Keyapis\Identity\V1\KeyError\UserNotFound $user_not_found
     *           Пользователь не найден в Ключе
     *     @type \Keyapis\Identity\V1\KeyError\UserIsBlocked $user_is_blocked
     *           Пользователь заблокирован
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Keyapis\Identity\V1\KeyapisIdentityAuthorizationV1::initOnce();
        parent::__construct($data);
    }

    /**
     * Ошибка создания пользователя
     *
     * Generated from protobuf field <code>.keyapis.identity.v1.KeyError.UserCreation user_creation = 1;</code>
     * @return \Keyapis\Identity\V1\KeyError\UserCreation|null
     */
    public function getUserCreation()
    {
        return $this->readOneof(1);
    }

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

    /**
     * Ошибка создания пользователя
     *
     * Generated from protobuf field <code>.keyapis.identity.v1.KeyError.UserCreation user_creation = 1;</code>
     * @param \Keyapis\Identity\V1\KeyError\UserCreation $var
     * @return $this
     */
    public function setUserCreation($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Identity\V1\KeyError\UserCreation::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Пользователь не найден в Ключе
     *
     * Generated from protobuf field <code>.keyapis.identity.v1.KeyError.UserNotFound user_not_found = 2;</code>
     * @return \Keyapis\Identity\V1\KeyError\UserNotFound|null
     */
    public function getUserNotFound()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Пользователь не найден в Ключе
     *
     * Generated from protobuf field <code>.keyapis.identity.v1.KeyError.UserNotFound user_not_found = 2;</code>
     * @param \Keyapis\Identity\V1\KeyError\UserNotFound $var
     * @return $this
     */
    public function setUserNotFound($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Identity\V1\KeyError\UserNotFound::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Пользователь заблокирован
     *
     * Generated from protobuf field <code>.keyapis.identity.v1.KeyError.UserIsBlocked user_is_blocked = 3;</code>
     * @return \Keyapis\Identity\V1\KeyError\UserIsBlocked|null
     */
    public function getUserIsBlocked()
    {
        return $this->readOneof(3);
    }

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

    /**
     * Пользователь заблокирован
     *
     * Generated from protobuf field <code>.keyapis.identity.v1.KeyError.UserIsBlocked user_is_blocked = 3;</code>
     * @param \Keyapis\Identity\V1\KeyError\UserIsBlocked $var
     * @return $this
     */
    public function setUserIsBlocked($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Identity\V1\KeyError\UserIsBlocked::class);
        $this->writeOneof(3, $var);

        return $this;
    }

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

}

