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

/**
 * Type of installment payments.
 *
 * Protobuf type <code>google.shopping.merchant.products.v1.CreditType</code>
 */
class CreditType
{
    /**
     * Default value. This value is unused.
     *
     * Generated from protobuf enum <code>CREDIT_TYPE_UNSPECIFIED = 0;</code>
     */
    const CREDIT_TYPE_UNSPECIFIED = 0;
    /**
     * Finance.
     *
     * Generated from protobuf enum <code>FINANCE = 1;</code>
     */
    const FINANCE = 1;
    /**
     * Lease.
     *
     * Generated from protobuf enum <code>LEASE = 2;</code>
     */
    const LEASE = 2;

    private static $valueToName = [
        self::CREDIT_TYPE_UNSPECIFIED => 'CREDIT_TYPE_UNSPECIFIED',
        self::FINANCE => 'FINANCE',
        self::LEASE => 'LEASE',
    ];

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

