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

namespace Google\Cloud\DataCatalog\V1\DatabaseTableSpec\DatabaseViewSpec;

use UnexpectedValueException;

/**
 * Concrete type of the view.
 *
 * Protobuf type <code>google.cloud.datacatalog.v1.DatabaseTableSpec.DatabaseViewSpec.ViewType</code>
 */
class ViewType
{
    /**
     * Default unknown view type.
     *
     * Generated from protobuf enum <code>VIEW_TYPE_UNSPECIFIED = 0;</code>
     */
    const VIEW_TYPE_UNSPECIFIED = 0;
    /**
     * Standard view.
     *
     * Generated from protobuf enum <code>STANDARD_VIEW = 1;</code>
     */
    const STANDARD_VIEW = 1;
    /**
     * Materialized view.
     *
     * Generated from protobuf enum <code>MATERIALIZED_VIEW = 2;</code>
     */
    const MATERIALIZED_VIEW = 2;

    private static $valueToName = [
        self::VIEW_TYPE_UNSPECIFIED => 'VIEW_TYPE_UNSPECIFIED',
        self::STANDARD_VIEW => 'STANDARD_VIEW',
        self::MATERIALIZED_VIEW => 'MATERIALIZED_VIEW',
    ];

    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(ViewType::class, \Google\Cloud\DataCatalog\V1\DatabaseTableSpec_DatabaseViewSpec_ViewType::class);

