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

namespace Google\Analytics\Admin\V1alpha\CalculatedMetric;

use UnexpectedValueException;

/**
 * Labels that mark the data in calculated metric used in conjunction with
 * user roles that restrict access to cost and/or revenue metrics.
 *
 * Protobuf type <code>google.analytics.admin.v1alpha.CalculatedMetric.RestrictedMetricType</code>
 */
class RestrictedMetricType
{
    /**
     * Type unknown or unspecified.
     *
     * Generated from protobuf enum <code>RESTRICTED_METRIC_TYPE_UNSPECIFIED = 0;</code>
     */
    const RESTRICTED_METRIC_TYPE_UNSPECIFIED = 0;
    /**
     * Metric reports cost data.
     *
     * Generated from protobuf enum <code>COST_DATA = 1;</code>
     */
    const COST_DATA = 1;
    /**
     * Metric reports revenue data.
     *
     * Generated from protobuf enum <code>REVENUE_DATA = 2;</code>
     */
    const REVENUE_DATA = 2;

    private static $valueToName = [
        self::RESTRICTED_METRIC_TYPE_UNSPECIFIED => 'RESTRICTED_METRIC_TYPE_UNSPECIFIED',
        self::COST_DATA => 'COST_DATA',
        self::REVENUE_DATA => 'REVENUE_DATA',
    ];

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

