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

namespace Keyapis\TelemetryControl\V1\TemplateDevice;

use UnexpectedValueException;

/**
 * Тип тарифного плана
 *
 * Protobuf type <code>keyapis.telemetry_control.v1.TemplateDevice.PlanType</code>
 */
class PlanType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>PLAN_TYPE_UNKNOWN = 0;</code>
     */
    const PLAN_TYPE_UNKNOWN = 0;
    /**
     * Однотарифный
     *
     * Generated from protobuf enum <code>SINGLE = 1;</code>
     */
    const SINGLE = 1;
    /**
     * Двухтарифный
     *
     * Generated from protobuf enum <code>DOUBLE = 2;</code>
     */
    const DOUBLE = 2;
    /**
     * Трёхтарифный
     *
     * Generated from protobuf enum <code>TRIPLE = 3;</code>
     */
    const TRIPLE = 3;

    private static $valueToName = [
        self::PLAN_TYPE_UNKNOWN => 'PLAN_TYPE_UNKNOWN',
        self::SINGLE => 'SINGLE',
        self::DOUBLE => 'DOUBLE',
        self::TRIPLE => 'TRIPLE',
    ];

    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(PlanType::class, \Keyapis\TelemetryControl\V1\TemplateDevice_PlanType::class);

