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

namespace Google\Cloud\Compute\V1\AuthorizationLoggingOptions;

use UnexpectedValueException;

/**
 * The type of the permission that was checked.
 *
 * Protobuf type <code>google.cloud.compute.v1.AuthorizationLoggingOptions.PermissionType</code>
 */
class PermissionType
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_PERMISSION_TYPE = 0;</code>
     */
    const UNDEFINED_PERMISSION_TYPE = 0;
    /**
     * Generated from protobuf enum <code>ADMIN_READ = 128951462;</code>
     */
    const ADMIN_READ = 128951462;
    /**
     * Generated from protobuf enum <code>ADMIN_WRITE = 244412079;</code>
     */
    const ADMIN_WRITE = 244412079;
    /**
     * Generated from protobuf enum <code>DATA_READ = 36789515;</code>
     */
    const DATA_READ = 36789515;
    /**
     * Generated from protobuf enum <code>DATA_WRITE = 71746282;</code>
     */
    const DATA_WRITE = 71746282;
    /**
     * Generated from protobuf enum <code>PERMISSION_TYPE_UNSPECIFIED = 171877890;</code>
     */
    const PERMISSION_TYPE_UNSPECIFIED = 171877890;

    private static $valueToName = [
        self::UNDEFINED_PERMISSION_TYPE => 'UNDEFINED_PERMISSION_TYPE',
        self::ADMIN_READ => 'ADMIN_READ',
        self::ADMIN_WRITE => 'ADMIN_WRITE',
        self::DATA_READ => 'DATA_READ',
        self::DATA_WRITE => 'DATA_WRITE',
        self::PERMISSION_TYPE_UNSPECIFIED => 'PERMISSION_TYPE_UNSPECIFIED',
    ];

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


