<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/apps/events/subscriptions/v1/subscription_resource.proto

namespace Google\Apps\Events\Subscriptions\V1\Subscription;

use UnexpectedValueException;

/**
 * Possible states for the subscription.
 *
 * Protobuf type <code>google.apps.events.subscriptions.v1.Subscription.State</code>
 */
class State
{
    /**
     * Default value. This value is unused.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * The subscription is active and can receive and deliver events to its
     * notification endpoint.
     *
     * Generated from protobuf enum <code>ACTIVE = 1;</code>
     */
    const ACTIVE = 1;
    /**
     * The subscription is unable to receive events due to an error.
     * To identify the error, see the
     * [`suspension_reason`][google.apps.events.subscriptions.v1.Subscription.suspension_reason]
     * field.
     *
     * Generated from protobuf enum <code>SUSPENDED = 2;</code>
     */
    const SUSPENDED = 2;
    /**
     * The subscription is deleted.
     *
     * Generated from protobuf enum <code>DELETED = 3;</code>
     */
    const DELETED = 3;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::ACTIVE => 'ACTIVE',
        self::SUSPENDED => 'SUSPENDED',
        self::DELETED => 'DELETED',
    ];

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

