<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/firestore/admin/v1/field.proto

namespace Google\Cloud\Firestore\Admin\V1\Field\TtlConfig;

use UnexpectedValueException;

/**
 * The state of applying the TTL configuration to all documents.
 *
 * Protobuf type <code>google.firestore.admin.v1.Field.TtlConfig.State</code>
 */
class State
{
    /**
     * The state is unspecified or unknown.
     *
     * Generated from protobuf enum <code>STATE_UNSPECIFIED = 0;</code>
     */
    const STATE_UNSPECIFIED = 0;
    /**
     * The TTL is being applied. There is an active long-running operation to
     * track the change. Newly written documents will have TTLs applied as
     * requested. Requested TTLs on existing documents are still being
     * processed. When TTLs on all existing documents have been processed, the
     * state will move to 'ACTIVE'.
     *
     * Generated from protobuf enum <code>CREATING = 1;</code>
     */
    const CREATING = 1;
    /**
     * The TTL is active for all documents.
     *
     * Generated from protobuf enum <code>ACTIVE = 2;</code>
     */
    const ACTIVE = 2;
    /**
     * The TTL configuration could not be enabled for all existing documents.
     * Newly written documents will continue to have their TTL applied.
     * The LRO returned when last attempting to enable TTL for this `Field`
     * has failed, and may have more details.
     *
     * Generated from protobuf enum <code>NEEDS_REPAIR = 3;</code>
     */
    const NEEDS_REPAIR = 3;

    private static $valueToName = [
        self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED',
        self::CREATING => 'CREATING',
        self::ACTIVE => 'ACTIVE',
        self::NEEDS_REPAIR => 'NEEDS_REPAIR',
    ];

    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(State::class, \Google\Cloud\Firestore\Admin\V1\Field_TtlConfig_State::class);

