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

namespace Deviceapis\Device\V1\RelayState;

use UnexpectedValueException;

/**
 * Тип состояния
 *
 * Protobuf type <code>deviceapis.device.v1.RelayState.StateType</code>
 */
class StateType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>STATE_TYPE_UNKNOWN = 0;</code>
     */
    const STATE_TYPE_UNKNOWN = 0;
    /**
     * Открыто временно
     *
     * Generated from protobuf enum <code>OPEN_TEMPORARY = 1;</code>
     */
    const OPEN_TEMPORARY = 1;
    /**
     * Закрыто
     *
     * Generated from protobuf enum <code>CLOSED = 2;</code>
     */
    const CLOSED = 2;
    /**
     * Открыто на всегда
     *
     * Generated from protobuf enum <code>OPEN_PERMANENT = 3;</code>
     */
    const OPEN_PERMANENT = 3;

    private static $valueToName = [
        self::STATE_TYPE_UNKNOWN => 'STATE_TYPE_UNKNOWN',
        self::OPEN_TEMPORARY => 'OPEN_TEMPORARY',
        self::CLOSED => 'CLOSED',
        self::OPEN_PERMANENT => 'OPEN_PERMANENT',
    ];

    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(StateType::class, \Deviceapis\Device\V1\RelayState_StateType::class);

