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

namespace Google\Cloud\Retail\V2;

use UnexpectedValueException;

/**
 * At which level we offer configuration for attributes.
 *
 * Protobuf type <code>google.cloud.retail.v2.AttributeConfigLevel</code>
 */
class AttributeConfigLevel
{
    /**
     * Value used when unset. In this case, server behavior defaults to
     * [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG].
     *
     * Generated from protobuf enum <code>ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0;</code>
     */
    const ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0;
    /**
     * At this level, we honor the attribute configurations set in
     * [Product.attributes][google.cloud.retail.v2.Product.attributes].
     *
     * Generated from protobuf enum <code>PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1;</code>
     */
    const PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1;
    /**
     * At this level, we honor the attribute configurations set in
     * [CatalogConfig.attribute_configs][].
     *
     * Generated from protobuf enum <code>CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2;</code>
     */
    const CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2;

    private static $valueToName = [
        self::ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED => 'ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED',
        self::PRODUCT_LEVEL_ATTRIBUTE_CONFIG => 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG',
        self::CATALOG_LEVEL_ATTRIBUTE_CONFIG => 'CATALOG_LEVEL_ATTRIBUTE_CONFIG',
    ];

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

