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

namespace Google\Cloud\Dialogflow\V2\Intent\TrainingPhrase;

use UnexpectedValueException;

/**
 * Represents different types of training phrases.
 *
 * Protobuf type <code>google.cloud.dialogflow.v2.Intent.TrainingPhrase.Type</code>
 */
class Type
{
    /**
     * Not specified. This value should never be used.
     *
     * Generated from protobuf enum <code>TYPE_UNSPECIFIED = 0;</code>
     */
    const TYPE_UNSPECIFIED = 0;
    /**
     * Examples do not contain &#64;-prefixed entity type names, but example parts
     * can be annotated with entity types.
     *
     * Generated from protobuf enum <code>EXAMPLE = 1;</code>
     */
    const EXAMPLE = 1;
    /**
     * Templates are not annotated with entity types, but they can contain
     * &#64;-prefixed entity type names as substrings.
     * Template mode has been deprecated. Example mode is the only supported
     * way to create new training phrases. If you have existing training
     * phrases that you've created in template mode, those will continue to
     * work.
     *
     * Generated from protobuf enum <code>TEMPLATE = 2 [deprecated = true];</code>
     */
    const TEMPLATE = 2;

    private static $valueToName = [
        self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED',
        self::EXAMPLE => 'EXAMPLE',
        self::TEMPLATE => 'TEMPLATE',
    ];

    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(Type::class, \Google\Cloud\Dialogflow\V2\Intent_TrainingPhrase_Type::class);

