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

namespace Keyapis\TelemetryControl\V1\DevicePaging;

use UnexpectedValueException;

/**
 * Справочник типов направлений сортировки
 *
 * Protobuf type <code>keyapis.telemetry_control.v1.DevicePaging.DirectionType</code>
 */
class DirectionType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>DIRECTION_TYPE_UNKNOWN = 0;</code>
     */
    const DIRECTION_TYPE_UNKNOWN = 0;
    /**
     * От большего к меньшему
     *
     * Generated from protobuf enum <code>DESC = 1;</code>
     */
    const DESC = 1;
    /**
     * От меньшего к большему
     *
     * Generated from protobuf enum <code>ASC = 2;</code>
     */
    const ASC = 2;

    private static $valueToName = [
        self::DIRECTION_TYPE_UNKNOWN => 'DIRECTION_TYPE_UNKNOWN',
        self::DESC => 'DESC',
        self::ASC => 'ASC',
    ];

    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)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(DirectionType::class, \Keyapis\TelemetryControl\V1\DevicePaging_DirectionType::class);

