<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/firestore/admin/v1/database.proto

namespace Google\Cloud\Firestore\Admin\V1\Database;

use UnexpectedValueException;

/**
 * The data access mode.
 *
 * Protobuf type <code>google.firestore.admin.v1.Database.DataAccessMode</code>
 */
class DataAccessMode
{
    /**
     * Not Used.
     *
     * Generated from protobuf enum <code>DATA_ACCESS_MODE_UNSPECIFIED = 0;</code>
     */
    const DATA_ACCESS_MODE_UNSPECIFIED = 0;
    /**
     * Accessing the database through the API is allowed.
     *
     * Generated from protobuf enum <code>DATA_ACCESS_MODE_ENABLED = 1;</code>
     */
    const DATA_ACCESS_MODE_ENABLED = 1;
    /**
     * Accessing the database through the API is disallowed.
     *
     * Generated from protobuf enum <code>DATA_ACCESS_MODE_DISABLED = 2;</code>
     */
    const DATA_ACCESS_MODE_DISABLED = 2;

    private static $valueToName = [
        self::DATA_ACCESS_MODE_UNSPECIFIED => 'DATA_ACCESS_MODE_UNSPECIFIED',
        self::DATA_ACCESS_MODE_ENABLED => 'DATA_ACCESS_MODE_ENABLED',
        self::DATA_ACCESS_MODE_DISABLED => 'DATA_ACCESS_MODE_DISABLED',
    ];

    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);
    }
}

