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

namespace Keyapis\Rfidregistry\V1\Record;

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

/**
 * Ошибка сохранения записи.
 * Эти проверки выполняются при работе с базой данных и сторонними сервисами
 *
 * Generated from protobuf message <code>keyapis.rfidregistry.v1.Record.SavingError</code>
 */
class SavingError extends \Google\Protobuf\Internal\Message
{
    protected $reason;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Keyapis\Rfidregistry\V1\Record\SavingError\StatusTypeRestricted $status_type_restricted
     *           Перевод статуса запрещён
     *     @type \Keyapis\Rfidregistry\V1\Record\SavingError\UidExist $uid_exist
     *           Запись уже существует
     *     @type \Keyapis\Rfidregistry\V1\Record\SavingError\OwnedByAnotherUser $owned_by_another_user
     *           Вы не владелец
     *     @type \Keyapis\Rfidregistry\V1\Record\SavingError\AlreadyLinked $already_linked
     *           Ключ уже использован
     *     @type \Keyapis\Rfidregistry\V1\Record\SavingError\Conflict $conflict
     *           Конфликт версий
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Keyapis\Rfidregistry\V1\KeyapisRfidregistryRecordV1::initOnce();
        parent::__construct($data);
    }

    /**
     * Перевод статуса запрещён
     *
     * Generated from protobuf field <code>.keyapis.rfidregistry.v1.Record.SavingError.StatusTypeRestricted status_type_restricted = 1;</code>
     * @return \Keyapis\Rfidregistry\V1\Record\SavingError\StatusTypeRestricted|null
     */
    public function getStatusTypeRestricted()
    {
        return $this->readOneof(1);
    }

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

    /**
     * Перевод статуса запрещён
     *
     * Generated from protobuf field <code>.keyapis.rfidregistry.v1.Record.SavingError.StatusTypeRestricted status_type_restricted = 1;</code>
     * @param \Keyapis\Rfidregistry\V1\Record\SavingError\StatusTypeRestricted $var
     * @return $this
     */
    public function setStatusTypeRestricted($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Rfidregistry\V1\Record\SavingError\StatusTypeRestricted::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Запись уже существует
     *
     * Generated from protobuf field <code>.keyapis.rfidregistry.v1.Record.SavingError.UidExist uid_exist = 2;</code>
     * @return \Keyapis\Rfidregistry\V1\Record\SavingError\UidExist|null
     */
    public function getUidExist()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Запись уже существует
     *
     * Generated from protobuf field <code>.keyapis.rfidregistry.v1.Record.SavingError.UidExist uid_exist = 2;</code>
     * @param \Keyapis\Rfidregistry\V1\Record\SavingError\UidExist $var
     * @return $this
     */
    public function setUidExist($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Rfidregistry\V1\Record\SavingError\UidExist::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Вы не владелец
     *
     * Generated from protobuf field <code>.keyapis.rfidregistry.v1.Record.SavingError.OwnedByAnotherUser owned_by_another_user = 3;</code>
     * @return \Keyapis\Rfidregistry\V1\Record\SavingError\OwnedByAnotherUser|null
     */
    public function getOwnedByAnotherUser()
    {
        return $this->readOneof(3);
    }

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

    /**
     * Вы не владелец
     *
     * Generated from protobuf field <code>.keyapis.rfidregistry.v1.Record.SavingError.OwnedByAnotherUser owned_by_another_user = 3;</code>
     * @param \Keyapis\Rfidregistry\V1\Record\SavingError\OwnedByAnotherUser $var
     * @return $this
     */
    public function setOwnedByAnotherUser($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Rfidregistry\V1\Record\SavingError\OwnedByAnotherUser::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * Ключ уже использован
     *
     * Generated from protobuf field <code>.keyapis.rfidregistry.v1.Record.SavingError.AlreadyLinked already_linked = 4;</code>
     * @return \Keyapis\Rfidregistry\V1\Record\SavingError\AlreadyLinked|null
     */
    public function getAlreadyLinked()
    {
        return $this->readOneof(4);
    }

    public function hasAlreadyLinked()
    {
        return $this->hasOneof(4);
    }

    /**
     * Ключ уже использован
     *
     * Generated from protobuf field <code>.keyapis.rfidregistry.v1.Record.SavingError.AlreadyLinked already_linked = 4;</code>
     * @param \Keyapis\Rfidregistry\V1\Record\SavingError\AlreadyLinked $var
     * @return $this
     */
    public function setAlreadyLinked($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Rfidregistry\V1\Record\SavingError\AlreadyLinked::class);
        $this->writeOneof(4, $var);

        return $this;
    }

    /**
     * Конфликт версий
     *
     * Generated from protobuf field <code>.keyapis.rfidregistry.v1.Record.SavingError.Conflict conflict = 5;</code>
     * @return \Keyapis\Rfidregistry\V1\Record\SavingError\Conflict|null
     */
    public function getConflict()
    {
        return $this->readOneof(5);
    }

    public function hasConflict()
    {
        return $this->hasOneof(5);
    }

    /**
     * Конфликт версий
     *
     * Generated from protobuf field <code>.keyapis.rfidregistry.v1.Record.SavingError.Conflict conflict = 5;</code>
     * @param \Keyapis\Rfidregistry\V1\Record\SavingError\Conflict $var
     * @return $this
     */
    public function setConflict($var)
    {
        GPBUtil::checkMessage($var, \Keyapis\Rfidregistry\V1\Record\SavingError\Conflict::class);
        $this->writeOneof(5, $var);

        return $this;
    }

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

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(SavingError::class, \Keyapis\Rfidregistry\V1\Record_SavingError::class);

