<?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 various types of the relationships between this product and the
 * related product.
 *
 * Protobuf type <code>google.shopping.merchant.products.v1.ProductAttributes.RelatedProduct.RelationshipType</code>
 */
class RelationshipType
{
    /**
     * The relationship type is unspecified.
     *
     * Generated from protobuf enum <code>RELATIONSHIP_TYPE_UNSPECIFIED = 0;</code>
     */
    const RELATIONSHIP_TYPE_UNSPECIFIED = 0;
    /**
     * Part of a set of products that are often purchased together.
     *
     * Generated from protobuf enum <code>PART_OF_SET = 1;</code>
     */
    const PART_OF_SET = 1;
    /**
     * Part that is necessary for the product to function, for example a
     * battery for a battery-operated lamp.
     *
     * Generated from protobuf enum <code>REQUIRED_PART = 2;</code>
     */
    const REQUIRED_PART = 2;
    /**
     * A product that this product is often purchased together with, for
     * example a phone case with a phone.
     *
     * Generated from protobuf enum <code>OFTEN_BOUGHT_WITH = 3;</code>
     */
    const OFTEN_BOUGHT_WITH = 3;
    /**
     * Product that this product can be substituted for. For example a printer
     * comparable in function to another printer.
     *
     * Generated from protobuf enum <code>SUBSTITUTE = 4;</code>
     */
    const SUBSTITUTE = 4;
    /**
     * An identical product sold under a different brand, for example a
     * cheaper house brand.
     *
     * Generated from protobuf enum <code>DIFFERENT_BRAND = 5;</code>
     */
    const DIFFERENT_BRAND = 5;
    /**
     * An accessory to this product, for example a side table that matches the
     * style of a couch.
     *
     * Generated from protobuf enum <code>ACCESSORY = 6;</code>
     */
    const ACCESSORY = 6;

    private static $valueToName = [
        self::RELATIONSHIP_TYPE_UNSPECIFIED => 'RELATIONSHIP_TYPE_UNSPECIFIED',
        self::PART_OF_SET => 'PART_OF_SET',
        self::REQUIRED_PART => 'REQUIRED_PART',
        self::OFTEN_BOUGHT_WITH => 'OFTEN_BOUGHT_WITH',
        self::SUBSTITUTE => 'SUBSTITUTE',
        self::DIFFERENT_BRAND => 'DIFFERENT_BRAND',
        self::ACCESSORY => 'ACCESSORY',
    ];

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

