package com.goafanti.common.enums;

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

import org.apache.commons.lang3.StringUtils;


public enum NoticeStatus {
	PATENTINFO(1, "专利申请管理"),
	COGNIZANCE(2, "高企认定管理"),
	COPYRIGHT(3, "软著申请管理"),
	TECHPROJECT(4, "科技项目申报管理"),
	PERSONALCERTIFY(5, "个人用户认证审核"),
	ORGANIZATIONCERTIFY(6, "团体组织用户认证审核"),
	CONTRACT(7, "合同管理"),
	PERSONALDEMAND(8, "个人用户科技需求管理"),
	ORGANIZATIONDEMAND(9, "团体组织用户需求管理"),
	PERSONALACHIEVEMENTT(10, "个人用户科技需求管理"),
	ORGANIZATIONACHIEVEMENT(11, "组织用户科技成果管理"),
	ORDER_CHANGE_ADD(12,"订单变更信息添加"),
	ORDER_CHANGE_UDPATE(13,"订单变更信息修改"),
	ORDER_DUN(14,"订单催款信息"),
	ORDER_BACK(15,"订单驳回信息"),
	ORDER_REFUND(16,"订单退单同意信息"),
	ORDER_BONUS(17,"奖金信息"),
	ORDER_REFUND_REFUSE(18,"退单拒绝信息"),
	ORDER_CHANGE_START(19,"订单变更发起"),
	ORDER_CHANGE_YES(20,"订单变更通过"),
	ORDER_CHANGE_NO(21,"订单变更驳回"),
	ORDER_CHANGE_END(22,"订单变更完成"),
	ORDER_INVPICE_START(23,"订单开票发起"),
	ORDER_INVPICE_YES(24,"订单开票通过"),
	ORDER_INVPICE_NO(25,"订单开票驳回"),
	ORDER_INVPICE_APPROVA_YES(26,"订单开票特批通过"),
	ORDER_INVPICE_APPROVA_NO(27,"订单开票特批驳回"),
	ORDER_INVPICE_END(28,"订单开票完成"),
	ORDER_START(29,"订单审核发起"),
	ORDER_APPROVA_YES(30,"订单特批通过"),
	ORDER_APPROVA_NO(31,"订单特批驳回"),
	ORDER_OUTSOURCE_YES(32,"订单外包通过"),
	ORDER_OUTSOURCE_NO(33,"订单外包驳回"),
	ORDER_YES(34,"订单审核通过"),
	ORDER_NO(35,"订单审核驳回"),
	ORDER_TASK_TO(36,"项目任务分配"),
	PROJECT_OUTSOURCE_START(37,"项目外包发起"),
	PROJECT_OUTSOURCE_YES(38,"项目外包通过"),
	PROJECT_OUTSOURCE_NO(39,"项目外包拒绝"),
	ORDER_ARREARS_DUN(40,"欠款催款信息"),
	TASK_PATENT_ERROR(41,"专利提醒失败"),
	TASK_PATENT_REMIND(42,"专利缴费提醒"),
	PAYMENT_DUN(43,"付款节点提醒"),
	PAYMENT_NODE(44,"付款审核通知"),
	PAYMENT_NO(45,"付款驳回通知"),
	PAYMENT_YES(46,"付款通过通知"),
	PAYMENT_COMPLETE(47,"财务付款通知"),
	CUSTOMER_PRIVATE_REMINDER(48,"客户私有提醒"),
	OTHER(0, "其他");

	private NoticeStatus(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

	static {
		for (NoticeStatus value : NoticeStatus.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static String getValueByCode(Integer code){
        for(NoticeStatus oticeStatus:NoticeStatus.values()){
            if(code.equals(oticeStatus.getCode())){
                return oticeStatus.getDesc();
            }
        }
        return  null;
    }

	public static NoticeStatus getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return OTHER;
	}

	public static NoticeStatus getStatus(String code) {
		if (StringUtils.isNumeric(code)) {
			return getStatus(Integer.parseInt(code));
		}
		return OTHER;
	}

	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}

	private Integer	code;
	private String	desc;

	public Integer getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

}
