<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: keyapis/invoice/v1/keyapis_invoice_paymethod_v1.proto

namespace Keyapis\Invoice\V1\PayMethod;

use UnexpectedValueException;

/**
 * Справочник типов банковских карт
 *
 * Protobuf type <code>keyapis.invoice.v1.PayMethod.CardType</code>
 */
class CardType
{
    /**
     * Значение не указано
     *
     * Generated from protobuf enum <code>CARD_TYPE_UNKNOWN = 0;</code>
     */
    const CARD_TYPE_UNKNOWN = 0;
    /**
     * Карта VISA
     *
     * Generated from protobuf enum <code>VISA = 1;</code>
     */
    const VISA = 1;
    /**
     * Карта EuroCard/MasterCard
     *
     * Generated from protobuf enum <code>EC_MC = 2;</code>
     */
    const EC_MC = 2;
    /**
     * Карта DinersClub
     *
     * Generated from protobuf enum <code>DCL = 3;</code>
     */
    const DCL = 3;
    /**
     * Карта JCB
     *
     * Generated from protobuf enum <code>JCB = 4;</code>
     */
    const JCB = 4;
    /**
     * Карта American Express
     *
     * Generated from protobuf enum <code>AMEX = 5;</code>
     */
    const AMEX = 5;
    /**
     * Платежная система "Мир"
     *
     * Generated from protobuf enum <code>MIR = 6;</code>
     */
    const MIR = 6;

    private static $valueToName = [
        self::CARD_TYPE_UNKNOWN => 'CARD_TYPE_UNKNOWN',
        self::VISA => 'VISA',
        self::EC_MC => 'EC_MC',
        self::DCL => 'DCL',
        self::JCB => 'JCB',
        self::AMEX => 'AMEX',
        self::MIR => 'MIR',
    ];

    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(CardType::class, \Keyapis\Invoice\V1\PayMethod_CardType::class);

