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

namespace Keyapis\Subscription\V1\OfferPaging;

use UnexpectedValueException;

/**
 * Справочник типов значений сортировки
 *
 * Protobuf type <code>keyapis.subscription.v1.OfferPaging.OrderByType</code>
 */
class OrderByType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>ORDER_BY_TYPE_UNKNOWN = 0;</code>
     */
    const ORDER_BY_TYPE_UNKNOWN = 0;
    /**
     * По идентификатору
     *
     * Generated from protobuf enum <code>ID = 1;</code>
     */
    const ID = 1;
    /**
     * По цене
     *
     * Generated from protobuf enum <code>PRICE = 2;</code>
     */
    const PRICE = 2;

    private static $valueToName = [
        self::ORDER_BY_TYPE_UNKNOWN => 'ORDER_BY_TYPE_UNKNOWN',
        self::ID => 'ID',
        self::PRICE => 'PRICE',
    ];

    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(OrderByType::class, \Keyapis\Subscription\V1\OfferPaging_OrderByType::class);

