package com.game.common.constant.finance;


import java.util.ArrayList;

import com.game.common.constant.ProjConfig;
import com.game.common.entity.KeyValue;
/**
 * 交易货币类型
 */
public enum TranCurrencyType {
    /**
     * 1人民币
     */
    RMB(1, "11274"),

    /**
     * 2金币
     */
    Coin(2, "11073"),

    /**
     * 3映票
     */
    Ticket(3, "11074"),

    /**
     * 4 余额
     */
    Balance(4, "11570");


    private String name;
    private int type;

    static KeyValue[] m_KeyValueArr;

    public static KeyValue[] getKeyValues() {
        if (m_KeyValueArr == null) {
            ArrayList<KeyValue> listKV = new ArrayList<KeyValue>();
            for (TranCurrencyType m : TranCurrencyType.values()) {
                KeyValue kv = new KeyValue("" + m.type, m.name);
                listKV.add(kv);
            }
            m_KeyValueArr = listKV.toArray(new KeyValue[listKV.size()]);
        }
        return m_KeyValueArr;
    }

    TranCurrencyType(int type, String name) {
        this.type = type;
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public int getType() {
        return type;
    }

    public static String getNameByType(int n) {
        if (n == 1) {
            return "人民币";
        } else if (n == 2) {
            return ProjConfig.getCoinName();
        } else if (n == 3) {
            return ProjConfig.getTicketName();
        }
        return null;
    }
}
