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

namespace Google\Cloud\Memorystore\V1beta\PersistenceConfig\RDBConfig;

use UnexpectedValueException;

/**
 * Possible snapshot periods.
 *
 * Protobuf type <code>google.cloud.memorystore.v1beta.PersistenceConfig.RDBConfig.SnapshotPeriod</code>
 */
class SnapshotPeriod
{
    /**
     * Not set.
     *
     * Generated from protobuf enum <code>SNAPSHOT_PERIOD_UNSPECIFIED = 0;</code>
     */
    const SNAPSHOT_PERIOD_UNSPECIFIED = 0;
    /**
     * One hour.
     *
     * Generated from protobuf enum <code>ONE_HOUR = 1;</code>
     */
    const ONE_HOUR = 1;
    /**
     * Six hours.
     *
     * Generated from protobuf enum <code>SIX_HOURS = 2;</code>
     */
    const SIX_HOURS = 2;
    /**
     * Twelve hours.
     *
     * Generated from protobuf enum <code>TWELVE_HOURS = 3;</code>
     */
    const TWELVE_HOURS = 3;
    /**
     * Twenty four hours.
     *
     * Generated from protobuf enum <code>TWENTY_FOUR_HOURS = 4;</code>
     */
    const TWENTY_FOUR_HOURS = 4;

    private static $valueToName = [
        self::SNAPSHOT_PERIOD_UNSPECIFIED => 'SNAPSHOT_PERIOD_UNSPECIFIED',
        self::ONE_HOUR => 'ONE_HOUR',
        self::SIX_HOURS => 'SIX_HOURS',
        self::TWELVE_HOURS => 'TWELVE_HOURS',
        self::TWENTY_FOUR_HOURS => 'TWENTY_FOUR_HOURS',
    ];

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


