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

namespace Google\Cloud\OrgPolicy\V1\Policy\ListPolicy;

use UnexpectedValueException;

/**
 * This enum can be used to set `Policies` that apply to all possible
 * configuration values rather than specific values in `allowed_values` or
 * `denied_values`.
 * Settting this to `ALLOW` will mean this `Policy` allows all values.
 * Similarly, setting it to `DENY` will mean no values are allowed. If
 * set to either `ALLOW` or `DENY,  `allowed_values` and `denied_values`
 * must be unset. Setting this to `ALL_VALUES_UNSPECIFIED` allows for
 * setting `allowed_values` and `denied_values`.
 *
 * Protobuf type <code>google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues</code>
 */
class AllValues
{
    /**
     * Indicates that allowed_values or denied_values must be set.
     *
     * Generated from protobuf enum <code>ALL_VALUES_UNSPECIFIED = 0;</code>
     */
    const ALL_VALUES_UNSPECIFIED = 0;
    /**
     * A policy with this set allows all values.
     *
     * Generated from protobuf enum <code>ALLOW = 1;</code>
     */
    const ALLOW = 1;
    /**
     * A policy with this set denies all values.
     *
     * Generated from protobuf enum <code>DENY = 2;</code>
     */
    const DENY = 2;

    private static $valueToName = [
        self::ALL_VALUES_UNSPECIFIED => 'ALL_VALUES_UNSPECIFIED',
        self::ALLOW => 'ALLOW',
        self::DENY => 'DENY',
    ];

    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(AllValues::class, \Google\Cloud\OrgPolicy\V1\Policy_ListPolicy_AllValues::class);

