<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/shopping/merchant/datasources/v1beta/datasourcetypes.proto

namespace Google\Shopping\Merchant\DataSources\V1beta\PrimaryProductDataSource;

use UnexpectedValueException;

/**
 * Data Source Channel.
 * Channel is used to distinguish between data sources for different product
 * verticals.
 *
 * Protobuf type <code>google.shopping.merchant.datasources.v1beta.PrimaryProductDataSource.Channel</code>
 */
class Channel
{
    /**
     * Not specified.
     *
     * Generated from protobuf enum <code>CHANNEL_UNSPECIFIED = 0;</code>
     */
    const CHANNEL_UNSPECIFIED = 0;
    /**
     * Online product.
     *
     * Generated from protobuf enum <code>ONLINE_PRODUCTS = 1;</code>
     */
    const ONLINE_PRODUCTS = 1;
    /**
     * Local product.
     *
     * Generated from protobuf enum <code>LOCAL_PRODUCTS = 2;</code>
     */
    const LOCAL_PRODUCTS = 2;
    /**
     * Unified data source for both local and online products.
     * Note: Products management through the API is not possible for this
     * channel.
     *
     * Generated from protobuf enum <code>PRODUCTS = 3;</code>
     */
    const PRODUCTS = 3;

    private static $valueToName = [
        self::CHANNEL_UNSPECIFIED => 'CHANNEL_UNSPECIFIED',
        self::ONLINE_PRODUCTS => 'ONLINE_PRODUCTS',
        self::LOCAL_PRODUCTS => 'LOCAL_PRODUCTS',
        self::PRODUCTS => 'PRODUCTS',
    ];

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

