<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: deviceapis/device/v1/deviceapis_device_encryption_profile_v1.proto

namespace Deviceapis\Device\V1\EncryptionProfile;

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

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

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Deviceapis\Device\V1\EncryptionProfile\SavingError\DuplicateName $duplicate_name
     *           Профиль с таким наименованием уже существует
     *     @type \Deviceapis\Device\V1\EncryptionProfile\SavingError\TooMuchEncryptionProfiles $too_much_encryption_profiles
     *           Превышено допустимое количество профилей шифрования
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Deviceapis\Device\V1\DeviceapisDeviceEncryptionProfileV1::initOnce();
        parent::__construct($data);
    }

    /**
     * Профиль с таким наименованием уже существует
     *
     * Generated from protobuf field <code>.deviceapis.device.v1.EncryptionProfile.SavingError.DuplicateName duplicate_name = 1;</code>
     * @return \Deviceapis\Device\V1\EncryptionProfile\SavingError\DuplicateName|null
     */
    public function getDuplicateName()
    {
        return $this->readOneof(1);
    }

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

    /**
     * Профиль с таким наименованием уже существует
     *
     * Generated from protobuf field <code>.deviceapis.device.v1.EncryptionProfile.SavingError.DuplicateName duplicate_name = 1;</code>
     * @param \Deviceapis\Device\V1\EncryptionProfile\SavingError\DuplicateName $var
     * @return $this
     */
    public function setDuplicateName($var)
    {
        GPBUtil::checkMessage($var, \Deviceapis\Device\V1\EncryptionProfile\SavingError\DuplicateName::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Превышено допустимое количество профилей шифрования
     *
     * Generated from protobuf field <code>.deviceapis.device.v1.EncryptionProfile.SavingError.TooMuchEncryptionProfiles too_much_encryption_profiles = 2;</code>
     * @return \Deviceapis\Device\V1\EncryptionProfile\SavingError\TooMuchEncryptionProfiles|null
     */
    public function getTooMuchEncryptionProfiles()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Превышено допустимое количество профилей шифрования
     *
     * Generated from protobuf field <code>.deviceapis.device.v1.EncryptionProfile.SavingError.TooMuchEncryptionProfiles too_much_encryption_profiles = 2;</code>
     * @param \Deviceapis\Device\V1\EncryptionProfile\SavingError\TooMuchEncryptionProfiles $var
     * @return $this
     */
    public function setTooMuchEncryptionProfiles($var)
    {
        GPBUtil::checkMessage($var, \Deviceapis\Device\V1\EncryptionProfile\SavingError\TooMuchEncryptionProfiles::class);
        $this->writeOneof(2, $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, \Deviceapis\Device\V1\EncryptionProfile_SavingError::class);

