<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/sql/v1beta4/cloud_sql_resources.proto

namespace Google\Cloud\Sql\V1beta4;

use UnexpectedValueException;

/**
 * Protobuf type <code>google.cloud.sql.v1beta4.SqlBackendType</code>
 */
class SqlBackendType
{
    /**
     * This is an unknown backend type for instance.
     *
     * Generated from protobuf enum <code>SQL_BACKEND_TYPE_UNSPECIFIED = 0;</code>
     */
    const SQL_BACKEND_TYPE_UNSPECIFIED = 0;
    /**
     * V1 speckle instance.
     *
     * Generated from protobuf enum <code>FIRST_GEN = 1 [deprecated = true];</code>
     */
    const FIRST_GEN = 1;
    /**
     * V2 speckle instance.
     *
     * Generated from protobuf enum <code>SECOND_GEN = 2;</code>
     */
    const SECOND_GEN = 2;
    /**
     * On premises instance.
     *
     * Generated from protobuf enum <code>EXTERNAL = 3;</code>
     */
    const EXTERNAL = 3;

    private static $valueToName = [
        self::SQL_BACKEND_TYPE_UNSPECIFIED => 'SQL_BACKEND_TYPE_UNSPECIFIED',
        self::FIRST_GEN => 'FIRST_GEN',
        self::SECOND_GEN => 'SECOND_GEN',
        self::EXTERNAL => 'EXTERNAL',
    ];

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

