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

namespace Google\Cloud\Ces\V1\Schema;

use UnexpectedValueException;

/**
 * OpenAPI data types.
 *
 * Protobuf type <code>google.cloud.ces.v1.Schema.Type</code>
 */
class Type
{
    /**
     * Type unspecified.
     *
     * Generated from protobuf enum <code>TYPE_UNSPECIFIED = 0;</code>
     */
    const TYPE_UNSPECIFIED = 0;
    /**
     * String type.
     *
     * Generated from protobuf enum <code>STRING = 1;</code>
     */
    const STRING = 1;
    /**
     * Integer type.
     *
     * Generated from protobuf enum <code>INTEGER = 2;</code>
     */
    const INTEGER = 2;
    /**
     * Number type.
     *
     * Generated from protobuf enum <code>NUMBER = 3;</code>
     */
    const NUMBER = 3;
    /**
     * Boolean type.
     *
     * Generated from protobuf enum <code>BOOLEAN = 4;</code>
     */
    const BOOLEAN = 4;
    /**
     * Object type.
     *
     * Generated from protobuf enum <code>OBJECT = 5;</code>
     */
    const OBJECT = 5;
    /**
     * Array type.
     *
     * Generated from protobuf enum <code>ARRAY = 6;</code>
     */
    const PBARRAY = 6;

    private static $valueToName = [
        self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED',
        self::STRING => 'STRING',
        self::INTEGER => 'INTEGER',
        self::NUMBER => 'NUMBER',
        self::BOOLEAN => 'BOOLEAN',
        self::OBJECT => 'OBJECT',
        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);
    }
}

