<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/dialogflow/v2/sip_trunk.proto

namespace Google\Cloud\Dialogflow\V2\Connection;

use UnexpectedValueException;

/**
 * The state of Sip Trunk connection.
 *
 * Protobuf type <code>google.cloud.dialogflow.v2.Connection.State</code>
 */
class State
{
    /**
     * SIP Trunk connection state is Not specified.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * SIP Trunk connection is connected.
     *
     * Generated from protobuf enum <code>CONNECTED = 1;</code>
     */
    const CONNECTED = 1;
    /**
     * SIP Trunk connection is disconnected.
     *
     * Generated from protobuf enum <code>DISCONNECTED = 2;</code>
     */
    const DISCONNECTED = 2;
    /**
     * SIP Trunk connection has authentication error.
     *
     * Generated from protobuf enum <code>AUTHENTICATION_FAILED = 3;</code>
     */
    const AUTHENTICATION_FAILED = 3;
    /**
     * SIP Trunk connection is keepalive.
     *
     * Generated from protobuf enum <code>KEEPALIVE = 4;</code>
     */
    const KEEPALIVE = 4;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::CONNECTED => 'CONNECTED',
        self::DISCONNECTED => 'DISCONNECTED',
        self::AUTHENTICATION_FAILED => 'AUTHENTICATION_FAILED',
        self::KEEPALIVE => 'KEEPALIVE',
    ];

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


