package com.goafanti.common.enums;

import org.apache.commons.lang3.StringUtils;

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


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,"限时跟进提醒"),
	CUSTOMER_LOSE_REMINDER(49,"限时丢失提醒"),
	CUSTOMER_LOSE30(50,"客户释放（30天）"),
	CUSTOMER_LOSE270(51,"客户释放（270天）"),
	CUSTOMER_CHENNEL_RECOVERY(52,"渠道客户回收"),
	CUSTOMER_CHENNEL_LOSE(53,"渠道客户丢失"),
	PUBLIC_RELEASE_START(54,"公出打卡申请"),
	PUBLIC_RELEASE_YES(55,"公出打卡通过"),
	PUBLIC_RELEASE_NO(56,"公出打卡驳回"),
	ITEM_CHECK_START(57,"发起专利核对"),
	ITEM_CHECK_END(58,"完成专利核对"),
	MENBER_DUN(59,"会员催款信息"),
	MENBER_START(60,"会员项目发起"),
	MENBER_YES(61,"会员项目通过"),
	MENBER_NO(62,"会员项目拒绝"),
	PROJECT_SOPT_START(63,"项目暂停流程发起"),
	PROJECT_SOPT_YES(64,"项目暂停流程通过"),
	PROJECT_SOPT_NO(65,"项目暂停流程拒绝"),
	PROJECT_RENEW_START(66,"项目重启流程发起"),
	PROJECT_RENEW_YES(67,"项目重启流程通过"),
	PROJECT_RENEW_NO(68,"项目重启流程拒绝"),
	AMB_INVEST_START(69,"阿米巴投资发起"),
	AMB_INVEST_YES(70,"阿米巴投资通过"),
	AMB_INVEST_NO(71,"阿米巴投资拒绝"),
	PUBLIC_OTHERS_USER(72,"公出他人企业"),
	COMPLETES_PROJECT(73,"项目完成通知"),
	EXPENSE_NOTICE(74,"报销审核通知"),
	EXPENSE_COMPLETE(75,"报销审核完成"),
	RESTRICT_PROJECT_LOSE30(76,"限时私有项目释放（30天）"),
	RESTRICT_PROJECT_LOSE270(77,"限时签单项目释放（270天）"),

	RESTRICT_PROJECT_LOSE30_REMIND(78,"限时私有项目释放提醒"),
	RESTRICT_PROJECT_LOSE270_REMIND(79,"限时签单项目释放提醒"),
	RECEIVE_RESTRICT_PROJECT(80,"领取限定项目"),
	PUBLIC_CARBON_COPY(81,"公出抄送"),
	PUBLIC_MAX_DURATION(82,"公出时长审核发起"),
	PUBLIC_MAX_DURATION_YES(83,"公出时长审核通过"),
	PUBLIC_MAX_DURATION_NO(84,"公出时长审核驳回"),
	CLUE_USER_RELEASE(85,"线索客户丢失"),
	ORDER_CANCELLATION_AMOUNT_RETURN(86,"订单取消金额返回"),
	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;
	}

}
