<?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;

/**
 * The digital source type.
 * Following [IPTC](https://cv.iptc.org/newscodes/digitalsourcetype).
 *
 * Protobuf type <code>google.shopping.merchant.products.v1.DigitalSourceType</code>
 */
class DigitalSourceType
{
    /**
     * Digital source type is unspecified.
     *
     * Generated from protobuf enum <code>DIGITAL_SOURCE_TYPE_UNSPECIFIED = 0;</code>
     */
    const DIGITAL_SOURCE_TYPE_UNSPECIFIED = 0;
    /**
     * Text created algorithmically using a model derived from sampled
     * content.
     *
     * Generated from protobuf enum <code>TRAINED_ALGORITHMIC_MEDIA = 1;</code>
     */
    const TRAINED_ALGORITHMIC_MEDIA = 1;
    /**
     * Text NOT created algorithmically using a model derived from sampled
     * content (the default)
     *
     * Generated from protobuf enum <code>DEFAULT = 2;</code>
     */
    const PBDEFAULT = 2;

    private static $valueToName = [
        self::DIGITAL_SOURCE_TYPE_UNSPECIFIED => 'DIGITAL_SOURCE_TYPE_UNSPECIFIED',
        self::TRAINED_ALGORITHMIC_MEDIA => 'TRAINED_ALGORITHMIC_MEDIA',
        self::PBDEFAULT => 'DEFAULT',
    ];

    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)) {
            $pbconst =  __CLASS__. '::PB' . strtoupper($name);
            if (!defined($pbconst)) {
                throw new UnexpectedValueException(sprintf(
                        'Enum %s has no value defined for name %s', __CLASS__, $name));
            }
            return constant($pbconst);
        }
        return constant($const);
    }
}

