<?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\ProductAttributes\RelatedProduct;

use UnexpectedValueException;

/**
 * The type of the identifier of the related product.
 *
 * Protobuf type <code>google.shopping.merchant.products.v1.ProductAttributes.RelatedProduct.IdType</code>
 */
class IdType
{
    /**
     * The identifier type is unspecified.
     *
     * Generated from protobuf enum <code>ID_TYPE_UNSPECIFIED = 0;</code>
     */
    const ID_TYPE_UNSPECIFIED = 0;
    /**
     * The identifier is a GTIN.
     *
     * Generated from protobuf enum <code>GTIN = 1;</code>
     */
    const GTIN = 1;
    /**
     * The identifier is a product ID in the feed.
     *
     * Generated from protobuf enum <code>ID = 2;</code>
     */
    const ID = 2;

    private static $valueToName = [
        self::ID_TYPE_UNSPECIFIED => 'ID_TYPE_UNSPECIFIED',
        self::GTIN => 'GTIN',
        self::ID => 'ID',
    ];

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

