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

namespace Google\Cloud\Dataplex\V1\Task\TriggerSpec;

use UnexpectedValueException;

/**
 * Determines how often and when the job will run.
 *
 * Protobuf type <code>google.cloud.dataplex.v1.Task.TriggerSpec.Type</code>
 */
class Type
{
    /**
     * Unspecified trigger type.
     *
     * Generated from protobuf enum <code>TYPE_UNSPECIFIED = 0;</code>
     */
    const TYPE_UNSPECIFIED = 0;
    /**
     * The task runs one-time shortly after Task Creation.
     *
     * Generated from protobuf enum <code>ON_DEMAND = 1;</code>
     */
    const ON_DEMAND = 1;
    /**
     * The task is scheduled to run periodically.
     *
     * Generated from protobuf enum <code>RECURRING = 2;</code>
     */
    const RECURRING = 2;

    private static $valueToName = [
        self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED',
        self::ON_DEMAND => 'ON_DEMAND',
        self::RECURRING => 'RECURRING',
    ];

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


