package com.goafanti.order.enums;

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

public enum LiquidationState {
	/** 首付待付清 **/
	WAIT_PAY_FIRST_BALANCE(0,"首付待付清"),
	/** 尾款待付清 **/
	WAIT_PAY_LAST_BALANCE(1,"尾款待付清"),
	/** 已付清 **/
	ALREADY_PAY(2,"已付清"),
	/** 退款待确认 **/
	WAIT_FOR_REFUND_CONFIRM(3,"退款待确认"),
	/** 退款已同意 **/
	AGREE_REFUND(4,"退款中"),
	/** 退款已拒绝 **/
	REFUSE_REFUND(5,"拒绝退款"),
	/** 退款已完成 **/
	COMPLETE_REFUND(6,"退款已完成"),
	/** 待提现 **/
	WAIT_FOR_WITHDRAW(7,"待提现"),
	/** 已提现 **/
	ALREADY_WITHDRAW(8,"已提现"),
	/** 无效 **/
	INVALID(10, "INVALID");
	
	private LiquidationState(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

	static {
		for (LiquidationState value : LiquidationState.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static LiquidationState 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;
	}
}
