<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/channel/v1/offers.proto

namespace Google\Cloud\Channel\V1;

use UnexpectedValueException;

/**
 * Constraints type for Promotional offers.
 *
 * Protobuf type <code>google.cloud.channel.v1.PromotionalOrderType</code>
 */
class PromotionalOrderType
{
    /**
     * Not used.
     *
     * Generated from protobuf enum <code>PROMOTIONAL_TYPE_UNSPECIFIED = 0;</code>
     */
    const PROMOTIONAL_TYPE_UNSPECIFIED = 0;
    /**
     * Order used for new customers, trial conversions and upgrades.
     *
     * Generated from protobuf enum <code>NEW_UPGRADE = 1;</code>
     */
    const NEW_UPGRADE = 1;
    /**
     * All orders for transferring an existing customer.
     *
     * Generated from protobuf enum <code>TRANSFER = 2;</code>
     */
    const TRANSFER = 2;
    /**
     * Orders for modifying an existing customer's promotion on the same SKU.
     *
     * Generated from protobuf enum <code>PROMOTION_SWITCH = 3;</code>
     */
    const PROMOTION_SWITCH = 3;

    private static $valueToName = [
        self::PROMOTIONAL_TYPE_UNSPECIFIED => 'PROMOTIONAL_TYPE_UNSPECIFIED',
        self::NEW_UPGRADE => 'NEW_UPGRADE',
        self::TRANSFER => 'TRANSFER',
        self::PROMOTION_SWITCH => 'PROMOTION_SWITCH',
    ];

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

