<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/redis/v1beta1/cloud_redis.proto

namespace Google\Cloud\Redis\V1beta1\FailoverInstanceRequest;

use UnexpectedValueException;

/**
 * Specifies different modes of operation in relation to the data retention.
 *
 * Protobuf type <code>google.cloud.redis.v1beta1.FailoverInstanceRequest.DataProtectionMode</code>
 */
class DataProtectionMode
{
    /**
     * Defaults to LIMITED_DATA_LOSS if a data protection mode is not
     * specified.
     *
     * Generated from protobuf enum <code>DATA_PROTECTION_MODE_UNSPECIFIED = 0;</code>
     */
    const DATA_PROTECTION_MODE_UNSPECIFIED = 0;
    /**
     * Instance failover will be protected with data loss control. More
     * specifically, the failover will only be performed if the current
     * replication offset diff between primary and replica is under a certain
     * threshold.
     *
     * Generated from protobuf enum <code>LIMITED_DATA_LOSS = 1;</code>
     */
    const LIMITED_DATA_LOSS = 1;
    /**
     * Instance failover will be performed without data loss control.
     *
     * Generated from protobuf enum <code>FORCE_DATA_LOSS = 2;</code>
     */
    const FORCE_DATA_LOSS = 2;

    private static $valueToName = [
        self::DATA_PROTECTION_MODE_UNSPECIFIED => 'DATA_PROTECTION_MODE_UNSPECIFIED',
        self::LIMITED_DATA_LOSS => 'LIMITED_DATA_LOSS',
        self::FORCE_DATA_LOSS => 'FORCE_DATA_LOSS',
    ];

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

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(DataProtectionMode::class, \Google\Cloud\Redis\V1beta1\FailoverInstanceRequest_DataProtectionMode::class);

