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

namespace Google\Cloud\Sql\V1\Settings;

use UnexpectedValueException;

/**
 * Specifies when the instance is activated.
 *
 * Protobuf type <code>google.cloud.sql.v1.Settings.SqlActivationPolicy</code>
 */
class SqlActivationPolicy
{
    /**
     * Unknown activation plan.
     *
     * Generated from protobuf enum <code>SQL_ACTIVATION_POLICY_UNSPECIFIED = 0;</code>
     */
    const SQL_ACTIVATION_POLICY_UNSPECIFIED = 0;
    /**
     * The instance is always up and running.
     *
     * Generated from protobuf enum <code>ALWAYS = 1;</code>
     */
    const ALWAYS = 1;
    /**
     * The instance never starts.
     *
     * Generated from protobuf enum <code>NEVER = 2;</code>
     */
    const NEVER = 2;
    /**
     * The instance starts upon receiving requests.
     *
     * Generated from protobuf enum <code>ON_DEMAND = 3 [deprecated = true];</code>
     */
    const ON_DEMAND = 3;

    private static $valueToName = [
        self::SQL_ACTIVATION_POLICY_UNSPECIFIED => 'SQL_ACTIVATION_POLICY_UNSPECIFIED',
        self::ALWAYS => 'ALWAYS',
        self::NEVER => 'NEVER',
        self::ON_DEMAND => 'ON_DEMAND',
    ];

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


