<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/monitoring/v3/alert.proto

namespace Google\Cloud\Monitoring\V3\AlertPolicy;

use UnexpectedValueException;

/**
 * Operators for combining conditions.
 *
 * Protobuf type <code>google.monitoring.v3.AlertPolicy.ConditionCombinerType</code>
 */
class ConditionCombinerType
{
    /**
     * An unspecified combiner.
     *
     * Generated from protobuf enum <code>COMBINE_UNSPECIFIED = 0;</code>
     */
    const COMBINE_UNSPECIFIED = 0;
    /**
     * Combine conditions using the logical `AND` operator. An
     * incident is created only if all conditions are met
     * simultaneously. This combiner is satisfied if all conditions are
     * met, even if they are met on completely different resources.
     *
     * Generated from protobuf enum <code>AND = 1;</code>
     */
    const PBAND = 1;
    /**
     * Combine conditions using the logical `OR` operator. An incident
     * is created if any of the listed conditions is met.
     *
     * Generated from protobuf enum <code>OR = 2;</code>
     */
    const PBOR = 2;
    /**
     * Combine conditions using logical `AND` operator, but unlike the regular
     * `AND` option, an incident is created only if all conditions are met
     * simultaneously on at least one resource.
     *
     * Generated from protobuf enum <code>AND_WITH_MATCHING_RESOURCE = 3;</code>
     */
    const AND_WITH_MATCHING_RESOURCE = 3;

    private static $valueToName = [
        self::COMBINE_UNSPECIFIED => 'COMBINE_UNSPECIFIED',
        self::PBAND => 'PBAND',
        self::PBOR => 'PBOR',
        self::AND_WITH_MATCHING_RESOURCE => 'AND_WITH_MATCHING_RESOURCE',
    ];

    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(ConditionCombinerType::class, \Google\Cloud\Monitoring\V3\AlertPolicy_ConditionCombinerType::class);

