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

namespace Google\Cloud\Retail\V2\CatalogAttribute;

use UnexpectedValueException;

/**
 * The status of the searchable option of a catalog attribute.
 *
 * Protobuf type <code>google.cloud.retail.v2.CatalogAttribute.SearchableOption</code>
 */
class SearchableOption
{
    /**
     * Value used when unset.
     *
     * Generated from protobuf enum <code>SEARCHABLE_OPTION_UNSPECIFIED = 0;</code>
     */
    const SEARCHABLE_OPTION_UNSPECIFIED = 0;
    /**
     * Searchable option enabled for an attribute.
     *
     * Generated from protobuf enum <code>SEARCHABLE_ENABLED = 1;</code>
     */
    const SEARCHABLE_ENABLED = 1;
    /**
     * Searchable option disabled for an attribute.
     *
     * Generated from protobuf enum <code>SEARCHABLE_DISABLED = 2;</code>
     */
    const SEARCHABLE_DISABLED = 2;

    private static $valueToName = [
        self::SEARCHABLE_OPTION_UNSPECIFIED => 'SEARCHABLE_OPTION_UNSPECIFIED',
        self::SEARCHABLE_ENABLED => 'SEARCHABLE_ENABLED',
        self::SEARCHABLE_DISABLED => 'SEARCHABLE_DISABLED',
    ];

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


