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

namespace Google\Cloud\PolicySimulator\V1;

use UnexpectedValueException;

/**
 * Whether a principal has a permission for a resource.
 *
 * Protobuf type <code>google.cloud.policysimulator.v1.AccessState</code>
 */
class AccessState
{
    /**
     * Default value. This value is unused.
     *
     * Generated from protobuf enum <code>ACCESS_STATE_UNSPECIFIED = 0;</code>
     */
    const ACCESS_STATE_UNSPECIFIED = 0;
    /**
     * The principal has the permission.
     *
     * Generated from protobuf enum <code>GRANTED = 1;</code>
     */
    const GRANTED = 1;
    /**
     * The principal does not have the permission.
     *
     * Generated from protobuf enum <code>NOT_GRANTED = 2;</code>
     */
    const NOT_GRANTED = 2;
    /**
     * The principal has the permission only if a condition expression evaluates
     * to `true`.
     *
     * Generated from protobuf enum <code>UNKNOWN_CONDITIONAL = 3;</code>
     */
    const UNKNOWN_CONDITIONAL = 3;
    /**
     * The user who created the
     * [Replay][google.cloud.policysimulator.v1.Replay] does not have
     * access to all of the policies that Policy Simulator needs to evaluate.
     *
     * Generated from protobuf enum <code>UNKNOWN_INFO_DENIED = 4;</code>
     */
    const UNKNOWN_INFO_DENIED = 4;

    private static $valueToName = [
        self::ACCESS_STATE_UNSPECIFIED => 'ACCESS_STATE_UNSPECIFIED',
        self::GRANTED => 'GRANTED',
        self::NOT_GRANTED => 'NOT_GRANTED',
        self::UNKNOWN_CONDITIONAL => 'UNKNOWN_CONDITIONAL',
        self::UNKNOWN_INFO_DENIED => 'UNKNOWN_INFO_DENIED',
    ];

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

