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

namespace Google\Cloud\BinaryAuthorization\V1beta1\AdmissionRule;

use UnexpectedValueException;

/**
 * Protobuf type <code>google.cloud.binaryauthorization.v1beta1.AdmissionRule.EvaluationMode</code>
 */
class EvaluationMode
{
    /**
     * Do not use.
     *
     * Generated from protobuf enum <code>EVALUATION_MODE_UNSPECIFIED = 0;</code>
     */
    const EVALUATION_MODE_UNSPECIFIED = 0;
    /**
     * This rule allows all all pod creations.
     *
     * Generated from protobuf enum <code>ALWAYS_ALLOW = 1;</code>
     */
    const ALWAYS_ALLOW = 1;
    /**
     * This rule allows a pod creation if all the attestors listed in
     * `require_attestations_by` have valid attestations for all of the
     * images in the pod spec.
     *
     * Generated from protobuf enum <code>REQUIRE_ATTESTATION = 2;</code>
     */
    const REQUIRE_ATTESTATION = 2;
    /**
     * This rule denies all pod creations.
     *
     * Generated from protobuf enum <code>ALWAYS_DENY = 3;</code>
     */
    const ALWAYS_DENY = 3;

    private static $valueToName = [
        self::EVALUATION_MODE_UNSPECIFIED => 'EVALUATION_MODE_UNSPECIFIED',
        self::ALWAYS_ALLOW => 'ALWAYS_ALLOW',
        self::REQUIRE_ATTESTATION => 'REQUIRE_ATTESTATION',
        self::ALWAYS_DENY => 'ALWAYS_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(EvaluationMode::class, \Google\Cloud\BinaryAuthorization\V1beta1\AdmissionRule_EvaluationMode::class);

