<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/analytics/data/v1beta/data.proto

namespace Google\Analytics\Data\V1beta;

use UnexpectedValueException;

/**
 * Represents aggregation of metrics.
 *
 * Protobuf type <code>google.analytics.data.v1beta.MetricAggregation</code>
 */
class MetricAggregation
{
    /**
     * Unspecified operator.
     *
     * Generated from protobuf enum <code>METRIC_AGGREGATION_UNSPECIFIED = 0;</code>
     */
    const METRIC_AGGREGATION_UNSPECIFIED = 0;
    /**
     * SUM operator.
     *
     * Generated from protobuf enum <code>TOTAL = 1;</code>
     */
    const TOTAL = 1;
    /**
     * Minimum operator.
     *
     * Generated from protobuf enum <code>MINIMUM = 5;</code>
     */
    const MINIMUM = 5;
    /**
     * Maximum operator.
     *
     * Generated from protobuf enum <code>MAXIMUM = 6;</code>
     */
    const MAXIMUM = 6;
    /**
     * Count operator.
     *
     * Generated from protobuf enum <code>COUNT = 4;</code>
     */
    const COUNT = 4;

    private static $valueToName = [
        self::METRIC_AGGREGATION_UNSPECIFIED => 'METRIC_AGGREGATION_UNSPECIFIED',
        self::TOTAL => 'TOTAL',
        self::MINIMUM => 'MINIMUM',
        self::MAXIMUM => 'MAXIMUM',
        self::COUNT => 'COUNT',
    ];

    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);
    }
}

