<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/shopping/merchant/products/v1/products_common.proto

namespace Google\Shopping\Merchant\Products\V1;

use UnexpectedValueException;

/**
 * [Availability](https://support.google.com/merchants/answer/6324448) status
 * of the item.
 *
 * Protobuf type <code>google.shopping.merchant.products.v1.Availability</code>
 */
class Availability
{
    /**
     * Availability is not specified.
     *
     * Generated from protobuf enum <code>AVAILABILITY_UNSPECIFIED = 0;</code>
     */
    const AVAILABILITY_UNSPECIFIED = 0;
    /**
     * In stock.
     *
     * Generated from protobuf enum <code>IN_STOCK = 1;</code>
     */
    const IN_STOCK = 1;
    /**
     * Out of stock.
     *
     * Generated from protobuf enum <code>OUT_OF_STOCK = 2;</code>
     */
    const OUT_OF_STOCK = 2;
    /**
     * Pre-order.
     *
     * Generated from protobuf enum <code>PREORDER = 3;</code>
     */
    const PREORDER = 3;
    /**
     * Limited availability.
     *
     * Generated from protobuf enum <code>LIMITED_AVAILABILITY = 4;</code>
     */
    const LIMITED_AVAILABILITY = 4;
    /**
     * Backorder.
     *
     * Generated from protobuf enum <code>BACKORDER = 5;</code>
     */
    const BACKORDER = 5;

    private static $valueToName = [
        self::AVAILABILITY_UNSPECIFIED => 'AVAILABILITY_UNSPECIFIED',
        self::IN_STOCK => 'IN_STOCK',
        self::OUT_OF_STOCK => 'OUT_OF_STOCK',
        self::PREORDER => 'PREORDER',
        self::LIMITED_AVAILABILITY => 'LIMITED_AVAILABILITY',
        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);
    }
}

