<?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\Device\MetricPoint;

use UnexpectedValueException;

/**
 * Справочние типов энергоресурсов
 *
 * Protobuf type <code>keyapis.telemetry_control.v1.Device.MetricPoint.MetricType</code>
 */
class MetricType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>METRIC_TYPE_UNKNOWN = 0;</code>
     */
    const METRIC_TYPE_UNKNOWN = 0;
    /**
     * Горячая вода
     *
     * Generated from protobuf enum <code>HOT_WATER = 1;</code>
     */
    const HOT_WATER = 1;
    /**
     * Холодная вода
     *
     * Generated from protobuf enum <code>COLD_WATER = 2;</code>
     */
    const COLD_WATER = 2;
    /**
     * Теплоэнергия
     *
     * Generated from protobuf enum <code>HEAT = 3;</code>
     */
    const HEAT = 3;
    /**
     * Газ
     *
     * Generated from protobuf enum <code>GAS = 4;</code>
     */
    const GAS = 4;
    /**
     * Электроэнергия
     *
     * Generated from protobuf enum <code>ELECTRICITY = 5;</code>
     */
    const ELECTRICITY = 5;

    private static $valueToName = [
        self::METRIC_TYPE_UNKNOWN => 'METRIC_TYPE_UNKNOWN',
        self::HOT_WATER => 'HOT_WATER',
        self::COLD_WATER => 'COLD_WATER',
        self::HEAT => 'HEAT',
        self::GAS => 'GAS',
        self::ELECTRICITY => 'ELECTRICITY',
    ];

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

