package com.goafanti.order.enums;

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

/**
 * 奖金科目
 * @author Administrator
 *
 */
public enum BonusSubject {
	SF(11,"首付奖"),
	WK(12,"尾款奖"),
	TK(16,"退款"),
	SB(21,"申报奖"),
	RZ(23,"立项奖"),
	RZQ(24,"公示奖"),
	
	/** 无效 **/
	INVALID(10, "INVALID");
	
	private BonusSubject(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

	static {
		for (BonusSubject value : BonusSubject.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static BonusSubject getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return INVALID;
	}
	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}
	
	public static String getValueByCode(Integer code){
        for(BonusSubject bonusSubject:BonusSubject.values()){
            if(code.equals(bonusSubject.getCode())){
                return bonusSubject.getDesc();
            }
        }
        return  null;
    }
	
	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;
	}
}
