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

namespace Google\Cloud\ErrorReporting\V1beta1;

use UnexpectedValueException;

/**
 * A sorting order of error groups.
 *
 * Protobuf type <code>google.devtools.clouderrorreporting.v1beta1.ErrorGroupOrder</code>
 */
class ErrorGroupOrder
{
    /**
     * No group order specified.
     *
     * Generated from protobuf enum <code>GROUP_ORDER_UNSPECIFIED = 0;</code>
     */
    const GROUP_ORDER_UNSPECIFIED = 0;
    /**
     * Total count of errors in the given time window in descending order.
     *
     * Generated from protobuf enum <code>COUNT_DESC = 1;</code>
     */
    const COUNT_DESC = 1;
    /**
     * Timestamp when the group was last seen in the given time window
     * in descending order.
     *
     * Generated from protobuf enum <code>LAST_SEEN_DESC = 2;</code>
     */
    const LAST_SEEN_DESC = 2;
    /**
     * Timestamp when the group was created in descending order.
     *
     * Generated from protobuf enum <code>CREATED_DESC = 3;</code>
     */
    const CREATED_DESC = 3;
    /**
     * Number of affected users in the given time window in descending order.
     *
     * Generated from protobuf enum <code>AFFECTED_USERS_DESC = 4;</code>
     */
    const AFFECTED_USERS_DESC = 4;

    private static $valueToName = [
        self::GROUP_ORDER_UNSPECIFIED => 'GROUP_ORDER_UNSPECIFIED',
        self::COUNT_DESC => 'COUNT_DESC',
        self::LAST_SEEN_DESC => 'LAST_SEEN_DESC',
        self::CREATED_DESC => 'CREATED_DESC',
        self::AFFECTED_USERS_DESC => 'AFFECTED_USERS_DESC',
    ];

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

