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

namespace Google\Ads\AdManager\V1\ReportDefinition;

use UnexpectedValueException;

/**
 * Possible metric value types to add.
 *
 * Protobuf type <code>google.ads.admanager.v1.ReportDefinition.MetricValueType</code>
 */
class MetricValueType
{
    /**
     * The values for the primary date_range.
     *
     * Generated from protobuf enum <code>PRIMARY = 0;</code>
     */
    const PRIMARY = 0;
    /**
     * Each metrics' percent of the total for the primary date_range.
     *
     * Generated from protobuf enum <code>PRIMARY_PERCENT_OF_TOTAL = 1;</code>
     */
    const PRIMARY_PERCENT_OF_TOTAL = 1;
    /**
     * The values for the comparison_date_range.
     *
     * Generated from protobuf enum <code>COMPARISON = 2;</code>
     */
    const COMPARISON = 2;
    /**
     * Each metrics' percent of the total for the comparison_date_range.
     *
     * Generated from protobuf enum <code>COMPARISON_PERCENT_OF_TOTAL = 3;</code>
     */
    const COMPARISON_PERCENT_OF_TOTAL = 3;
    /**
     * The absolute change between the primary and comparison date ranges.
     *
     * Generated from protobuf enum <code>ABSOLUTE_CHANGE = 4;</code>
     */
    const ABSOLUTE_CHANGE = 4;
    /**
     * The relative change between the primary and comparison date ranges.
     *
     * Generated from protobuf enum <code>RELATIVE_CHANGE = 5;</code>
     */
    const RELATIVE_CHANGE = 5;

    private static $valueToName = [
        self::PRIMARY => 'PRIMARY',
        self::PRIMARY_PERCENT_OF_TOTAL => 'PRIMARY_PERCENT_OF_TOTAL',
        self::COMPARISON => 'COMPARISON',
        self::COMPARISON_PERCENT_OF_TOTAL => 'COMPARISON_PERCENT_OF_TOTAL',
        self::ABSOLUTE_CHANGE => 'ABSOLUTE_CHANGE',
        self::RELATIVE_CHANGE => 'RELATIVE_CHANGE',
    ];

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

