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

namespace Google\Cloud\RecommendationEngine\V1beta1\ProductCatalogItem;

use UnexpectedValueException;

/**
 * Item stock state. If this field is unspecified, the item is
 * assumed to be in stock.
 *
 * Protobuf type <code>google.cloud.recommendationengine.v1beta1.ProductCatalogItem.StockState</code>
 */
class StockState
{
    /**
     * Default item stock status. Should never be used.
     *
     * Generated from protobuf enum <code>STOCK_STATE_UNSPECIFIED = 0;</code>
     */
    const STOCK_STATE_UNSPECIFIED = 0;
    /**
     * Item in stock.
     *
     * Generated from protobuf enum <code>IN_STOCK = 0;</code>
     */
    const IN_STOCK = 0;
    /**
     * Item out of stock.
     *
     * Generated from protobuf enum <code>OUT_OF_STOCK = 1;</code>
     */
    const OUT_OF_STOCK = 1;
    /**
     * Item that is in pre-order state.
     *
     * Generated from protobuf enum <code>PREORDER = 2;</code>
     */
    const PREORDER = 2;
    /**
     * Item that is back-ordered (i.e. temporarily out of stock).
     *
     * Generated from protobuf enum <code>BACKORDER = 3;</code>
     */
    const BACKORDER = 3;

    private static $valueToName = [
        self::STOCK_STATE_UNSPECIFIED => 'STOCK_STATE_UNSPECIFIED',
        self::IN_STOCK => 'IN_STOCK',
        self::OUT_OF_STOCK => 'OUT_OF_STOCK',
        self::PREORDER => 'PREORDER',
        self::BACKORDER => 'BACKORDER',
    ];

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


