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

namespace Keyapis\AccessControl\V1\EntranceDevice;

use UnexpectedValueException;

/**
 * Тип связки
 *
 * Protobuf type <code>keyapis.access_control.v1.EntranceDevice.RelationType</code>
 */
class RelationType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>RELATION_TYPE_UNKNOWN = 0;</code>
     */
    const RELATION_TYPE_UNKNOWN = 0;
    /**
     * Полная связь
     *
     * Generated from protobuf enum <code>FULL = 1;</code>
     */
    const FULL = 1;
    /**
     * Частичная связь
     *
     * Generated from protobuf enum <code>PARTIAL = 2;</code>
     */
    const PARTIAL = 2;

    private static $valueToName = [
        self::RELATION_TYPE_UNKNOWN => 'RELATION_TYPE_UNKNOWN',
        self::FULL => 'FULL',
        self::PARTIAL => 'PARTIAL',
    ];

    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(RelationType::class, \Keyapis\AccessControl\V1\EntranceDevice_RelationType::class);

