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

namespace Google\Cloud\Firestore\V1beta1\TargetChange;

use UnexpectedValueException;

/**
 * The type of change.
 *
 * Protobuf type <code>google.firestore.v1beta1.TargetChange.TargetChangeType</code>
 */
class TargetChangeType
{
    /**
     * No change has occurred. Used only to send an updated `resume_token`.
     *
     * Generated from protobuf enum <code>NO_CHANGE = 0;</code>
     */
    const NO_CHANGE = 0;
    /**
     * The targets have been added.
     *
     * Generated from protobuf enum <code>ADD = 1;</code>
     */
    const ADD = 1;
    /**
     * The targets have been removed.
     *
     * Generated from protobuf enum <code>REMOVE = 2;</code>
     */
    const REMOVE = 2;
    /**
     * The targets reflect all changes committed before the targets were added
     * to the stream.
     * This will be sent after or with a `read_time` that is greater than or
     * equal to the time at which the targets were added.
     * Listeners can wait for this change if read-after-write semantics
     * are desired.
     *
     * Generated from protobuf enum <code>CURRENT = 3;</code>
     */
    const CURRENT = 3;
    /**
     * The targets have been reset, and a new initial state for the targets
     * will be returned in subsequent changes.
     * After the initial state is complete, `CURRENT` will be returned even
     * if the target was previously indicated to be `CURRENT`.
     *
     * Generated from protobuf enum <code>RESET = 4;</code>
     */
    const RESET = 4;

    private static $valueToName = [
        self::NO_CHANGE => 'NO_CHANGE',
        self::ADD => 'ADD',
        self::REMOVE => 'REMOVE',
        self::CURRENT => 'CURRENT',
        self::RESET => 'RESET',
    ];

    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(TargetChangeType::class, \Google\Cloud\Firestore\V1beta1\TargetChange_TargetChangeType::class);

