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

namespace Google\Cloud\Billing\V1\AggregationInfo;

use UnexpectedValueException;

/**
 * The level at which usage is aggregated to compute cost.
 * Example: "ACCOUNT" aggregation level indicates that usage for tiered
 * pricing is aggregated across all projects in a single account.
 *
 * Protobuf type <code>google.cloud.billing.v1.AggregationInfo.AggregationLevel</code>
 */
class AggregationLevel
{
    /**
     * Generated from protobuf enum <code>AGGREGATION_LEVEL_UNSPECIFIED = 0;</code>
     */
    const AGGREGATION_LEVEL_UNSPECIFIED = 0;
    /**
     * Generated from protobuf enum <code>ACCOUNT = 1;</code>
     */
    const ACCOUNT = 1;
    /**
     * Generated from protobuf enum <code>PROJECT = 2;</code>
     */
    const PROJECT = 2;

    private static $valueToName = [
        self::AGGREGATION_LEVEL_UNSPECIFIED => 'AGGREGATION_LEVEL_UNSPECIFIED',
        self::ACCOUNT => 'ACCOUNT',
        self::PROJECT => 'PROJECT',
    ];

    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(AggregationLevel::class, \Google\Cloud\Billing\V1\AggregationInfo_AggregationLevel::class);

