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

namespace Google\Shopping\Merchant\Reports\V1beta\ReportGranularity;

use UnexpectedValueException;

/**
 * Report granularity values.
 *
 * Protobuf type <code>google.shopping.merchant.reports.v1beta.ReportGranularity.ReportGranularityEnum</code>
 */
class ReportGranularityEnum
{
    /**
     * Not specified.
     *
     * Generated from protobuf enum <code>REPORT_GRANULARITY_ENUM_UNSPECIFIED = 0;</code>
     */
    const REPORT_GRANULARITY_ENUM_UNSPECIFIED = 0;
    /**
     * Report is computed over a week timeframe.
     *
     * Generated from protobuf enum <code>WEEKLY = 1;</code>
     */
    const WEEKLY = 1;
    /**
     * Report is computed over a month timeframe.
     *
     * Generated from protobuf enum <code>MONTHLY = 2;</code>
     */
    const MONTHLY = 2;

    private static $valueToName = [
        self::REPORT_GRANULARITY_ENUM_UNSPECIFIED => 'REPORT_GRANULARITY_ENUM_UNSPECIFIED',
        self::WEEKLY => 'WEEKLY',
        self::MONTHLY => 'MONTHLY',
    ];

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


