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

namespace Google\Cloud\Channel\V1;

use UnexpectedValueException;

/**
 * Specifies when the payment needs to happen.
 *
 * Protobuf type <code>google.cloud.channel.v1.PaymentType</code>
 */
class PaymentType
{
    /**
     * Not used.
     *
     * Generated from protobuf enum <code>PAYMENT_TYPE_UNSPECIFIED = 0;</code>
     */
    const PAYMENT_TYPE_UNSPECIFIED = 0;
    /**
     * Prepay. Amount has to be paid before service is rendered.
     *
     * Generated from protobuf enum <code>PREPAY = 1;</code>
     */
    const PREPAY = 1;
    /**
     * Postpay. Reseller is charged at the end of the Payment cycle.
     *
     * Generated from protobuf enum <code>POSTPAY = 2;</code>
     */
    const POSTPAY = 2;

    private static $valueToName = [
        self::PAYMENT_TYPE_UNSPECIFIED => 'PAYMENT_TYPE_UNSPECIFIED',
        self::PREPAY => 'PREPAY',
        self::POSTPAY => 'POSTPAY',
    ];

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

