<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/devtools/clouderrorreporting/v1beta1/error_stats_service.proto

namespace Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange;

use UnexpectedValueException;

/**
 * The supported time ranges.
 *
 * Protobuf type <code>google.devtools.clouderrorreporting.v1beta1.QueryTimeRange.Period</code>
 */
class Period
{
    /**
     * Do not use.
     *
     * Generated from protobuf enum <code>PERIOD_UNSPECIFIED = 0;</code>
     */
    const PERIOD_UNSPECIFIED = 0;
    /**
     * Retrieve data for the last hour.
     * Recommended minimum timed count duration: 1 min.
     *
     * Generated from protobuf enum <code>PERIOD_1_HOUR = 1;</code>
     */
    const PERIOD_1_HOUR = 1;
    /**
     * Retrieve data for the last 6 hours.
     * Recommended minimum timed count duration: 10 min.
     *
     * Generated from protobuf enum <code>PERIOD_6_HOURS = 2;</code>
     */
    const PERIOD_6_HOURS = 2;
    /**
     * Retrieve data for the last day.
     * Recommended minimum timed count duration: 1 hour.
     *
     * Generated from protobuf enum <code>PERIOD_1_DAY = 3;</code>
     */
    const PERIOD_1_DAY = 3;
    /**
     * Retrieve data for the last week.
     * Recommended minimum timed count duration: 6 hours.
     *
     * Generated from protobuf enum <code>PERIOD_1_WEEK = 4;</code>
     */
    const PERIOD_1_WEEK = 4;
    /**
     * Retrieve data for the last 30 days.
     * Recommended minimum timed count duration: 1 day.
     *
     * Generated from protobuf enum <code>PERIOD_30_DAYS = 5;</code>
     */
    const PERIOD_30_DAYS = 5;

    private static $valueToName = [
        self::PERIOD_UNSPECIFIED => 'PERIOD_UNSPECIFIED',
        self::PERIOD_1_HOUR => 'PERIOD_1_HOUR',
        self::PERIOD_6_HOURS => 'PERIOD_6_HOURS',
        self::PERIOD_1_DAY => 'PERIOD_1_DAY',
        self::PERIOD_1_WEEK => 'PERIOD_1_WEEK',
        self::PERIOD_30_DAYS => 'PERIOD_30_DAYS',
    ];

    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(Period::class, \Google\Cloud\ErrorReporting\V1beta1\QueryTimeRange_Period::class);

