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

namespace Google\Cloud\Dialogflow\Cx\V3;

use UnexpectedValueException;

/**
 * Defines data types that are supported for inlined schemas. These types are
 * consistent with [google.protobuf.Value][google.protobuf.Value].
 *
 * Protobuf type <code>google.cloud.dialogflow.cx.v3.DataType</code>
 */
class DataType
{
    /**
     * Not specified.
     *
     * Generated from protobuf enum <code>DATA_TYPE_UNSPECIFIED = 0;</code>
     */
    const DATA_TYPE_UNSPECIFIED = 0;
    /**
     * Represents any string value.
     *
     * Generated from protobuf enum <code>STRING = 1;</code>
     */
    const STRING = 1;
    /**
     * Represents any number value.
     *
     * Generated from protobuf enum <code>NUMBER = 2;</code>
     */
    const NUMBER = 2;
    /**
     * Represents a boolean value.
     *
     * Generated from protobuf enum <code>BOOLEAN = 3;</code>
     */
    const BOOLEAN = 3;
    /**
     * Represents a repeated value.
     *
     * Generated from protobuf enum <code>ARRAY = 6;</code>
     */
    const PBARRAY = 6;

    private static $valueToName = [
        self::DATA_TYPE_UNSPECIFIED => 'DATA_TYPE_UNSPECIFIED',
        self::STRING => 'STRING',
        self::NUMBER => 'NUMBER',
        self::BOOLEAN => 'BOOLEAN',
        self::PBARRAY => 'ARRAY',
    ];

    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)) {
            $pbconst =  __CLASS__. '::PB' . strtoupper($name);
            if (!defined($pbconst)) {
                throw new UnexpectedValueException(sprintf(
                        'Enum %s has no value defined for name %s', __CLASS__, $name));
            }
            return constant($pbconst);
        }
        return constant($const);
    }
}

