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

namespace Google\Cloud\Compute\V1\HealthCheckService;

use UnexpectedValueException;

/**
 * Optional. Policy for how the results from multiple health checks for the same endpoint are aggregated. Defaults to NO_AGGREGATION if unspecified. - NO_AGGREGATION. An EndpointHealth message is returned for each pair in the health check service. - AND. If any health check of an endpoint reports UNHEALTHY, then UNHEALTHY is the HealthState of the endpoint. If all health checks report HEALTHY, the HealthState of the endpoint is HEALTHY. . This is only allowed with regional HealthCheckService.
 *
 * Protobuf type <code>google.cloud.compute.v1.HealthCheckService.HealthStatusAggregationPolicy</code>
 */
class HealthStatusAggregationPolicy
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum <code>UNDEFINED_HEALTH_STATUS_AGGREGATION_POLICY = 0;</code>
     */
    const UNDEFINED_HEALTH_STATUS_AGGREGATION_POLICY = 0;
    /**
     * If any backend's health check reports UNHEALTHY, then UNHEALTHY is the HealthState of the entire health check service. If all backend's are healthy, the HealthState of the health check service is HEALTHY.
     *
     * Generated from protobuf enum <code>AND = 64951;</code>
     */
    const PBAND = 64951;
    /**
     * An EndpointHealth message is returned for each backend in the health check service.
     *
     * Generated from protobuf enum <code>NO_AGGREGATION = 426445124;</code>
     */
    const NO_AGGREGATION = 426445124;

    private static $valueToName = [
        self::UNDEFINED_HEALTH_STATUS_AGGREGATION_POLICY => 'UNDEFINED_HEALTH_STATUS_AGGREGATION_POLICY',
        self::PBAND => 'AND',
        self::NO_AGGREGATION => 'NO_AGGREGATION',
    ];

    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)) {
            $pbconst =  __CLASS__. '::PB' . strtoupper($name);
            if (!defined($pbconst)) {
                throw new UnexpectedValueException(sprintf(
                        'Enum %s has no value defined for name %s', __CLASS__, $name));
            }
            return constant($pbconst);
        }
        return constant($const);
    }
}


