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

namespace Google\Cloud\Datastream\V1\BackfillJob;

use UnexpectedValueException;

/**
 * Triggering reason for a backfill job.
 *
 * Protobuf type <code>google.cloud.datastream.v1.BackfillJob.Trigger</code>
 */
class Trigger
{
    /**
     * Default value.
     *
     * Generated from protobuf enum <code>TRIGGER_UNSPECIFIED = 0;</code>
     */
    const TRIGGER_UNSPECIFIED = 0;
    /**
     * Object backfill job was triggered automatically according to the stream's
     * backfill strategy.
     *
     * Generated from protobuf enum <code>AUTOMATIC = 1;</code>
     */
    const AUTOMATIC = 1;
    /**
     * Object backfill job was triggered manually using the dedicated API.
     *
     * Generated from protobuf enum <code>MANUAL = 2;</code>
     */
    const MANUAL = 2;

    private static $valueToName = [
        self::TRIGGER_UNSPECIFIED => 'TRIGGER_UNSPECIFIED',
        self::AUTOMATIC => 'AUTOMATIC',
        self::MANUAL => 'MANUAL',
    ];

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


