package com.goafanti.order.enums;

import java.util.HashMap;
import java.util.Map;

public enum TransactionMode {
	/** 线上支付 **/
	ONLINE(0,"ONLINE"),
	/** 线下支付 **/
	OFFLINE(1,"OFFLINE"),
	/** 无效 **/
	INVALID(10, "INVALID");
	
	private TransactionMode(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	private static Map<Integer, TransactionMode> status = new HashMap<Integer, TransactionMode>();

	static {
		for (TransactionMode value : TransactionMode.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static TransactionMode getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return INVALID;
	}
	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}
	
	private Integer	code;
	private String	desc;
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
}
