<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/shopping/type/types.proto

namespace Google\Shopping\Type\Channel;

use UnexpectedValueException;

/**
 * Channel values.
 *
 * Protobuf type <code>google.shopping.type.Channel.ChannelEnum</code>
 */
class ChannelEnum
{
    /**
     * Not specified.
     *
     * Generated from protobuf enum <code>CHANNEL_ENUM_UNSPECIFIED = 0;</code>
     */
    const CHANNEL_ENUM_UNSPECIFIED = 0;
    /**
     * Online product.
     *
     * Generated from protobuf enum <code>ONLINE = 1;</code>
     */
    const ONLINE = 1;
    /**
     * Local product.
     *
     * Generated from protobuf enum <code>LOCAL = 2;</code>
     */
    const LOCAL = 2;

    private static $valueToName = [
        self::CHANNEL_ENUM_UNSPECIFIED => 'CHANNEL_ENUM_UNSPECIFIED',
        self::ONLINE => 'ONLINE',
        self::LOCAL => 'LOCAL',
    ];

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

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(ChannelEnum::class, \Google\Shopping\Type\Channel_ChannelEnum::class);

