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

namespace Keyapis\Device\V1\SyncStatus;

use UnexpectedValueException;

/**
 * Статус синхронизации.
 * # Тип: byte
 *
 * Protobuf type <code>keyapis.device.v1.SyncStatus.StatusType</code>
 */
class StatusType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>STATUS_TYPE_UNKNOWN = 0;</code>
     */
    const STATUS_TYPE_UNKNOWN = 0;
    /**
     * Новый
     *
     * Generated from protobuf enum <code>NEW = 1;</code>
     */
    const PBNEW = 1;
    /**
     * В процессе
     *
     * Generated from protobuf enum <code>PENDING = 2;</code>
     */
    const PENDING = 2;
    /**
     * Ошибка
     *
     * Generated from protobuf enum <code>ERROR = 3;</code>
     */
    const ERROR = 3;
    /**
     * Успешно
     *
     * Generated from protobuf enum <code>SUCCESS = 4;</code>
     */
    const SUCCESS = 4;
    /**
     * Выключено
     *
     * Generated from protobuf enum <code>DISABLED = 5;</code>
     */
    const DISABLED = 5;

    private static $valueToName = [
        self::STATUS_TYPE_UNKNOWN => 'STATUS_TYPE_UNKNOWN',
        self::PBNEW => 'NEW',
        self::PENDING => 'PENDING',
        self::ERROR => 'ERROR',
        self::SUCCESS => 'SUCCESS',
        self::DISABLED => 'DISABLED',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            $pbconst =  __CLASS__. '::PB' . strtoupper($name);
            if (!defined($pbconst)) {
                throw new UnexpectedValueException(sprintf(
                        'Enum %s has no value defined for name %s', __CLASS__, $name));
            }
            return constant($pbconst);
        }
        return constant($const);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(StatusType::class, \Keyapis\Device\V1\SyncStatus_StatusType::class);

