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

namespace Google\Cloud\Sql\V1\BackupReencryptionConfig;

use UnexpectedValueException;

/**
 * Backup type for re-encryption
 *
 * Protobuf type <code>google.cloud.sql.v1.BackupReencryptionConfig.BackupType</code>
 */
class BackupType
{
    /**
     * Unknown backup type, will be defaulted to AUTOMATIC backup type
     *
     * Generated from protobuf enum <code>BACKUP_TYPE_UNSPECIFIED = 0;</code>
     */
    const BACKUP_TYPE_UNSPECIFIED = 0;
    /**
     * Reencrypt automatic backups
     *
     * Generated from protobuf enum <code>AUTOMATED = 1;</code>
     */
    const AUTOMATED = 1;
    /**
     * Reencrypt on-demand backups
     *
     * Generated from protobuf enum <code>ON_DEMAND = 2;</code>
     */
    const ON_DEMAND = 2;

    private static $valueToName = [
        self::BACKUP_TYPE_UNSPECIFIED => 'BACKUP_TYPE_UNSPECIFIED',
        self::AUTOMATED => 'AUTOMATED',
        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);
    }
}


