package com.iformall.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

public enum EnumInvestMessageType {

	TASK_REMIND(0, "【%d】需在%s前完成，请及时跟进！"),
	COSTOMER_REMIND(1, "【%d】已超过一周没有跟进，请及时跟进！"),
	TASK_CREATE(2, "管理员向您指派了一个任务"),
	CUSTOMER_CREATE(3, "管理员向您指派了一个客户"),
	;

	public static String message(EnumInvestMessageType type, Object... args) {
		return String.format(type.info, args);
	}

	public static EnumInvestMessageType getEnum(Integer code) {
		for (EnumInvestMessageType value : values()) {
			if (value.getCode().equals(code)) {
				return value;
			}
		}
		return null;
	}

	@EnumValue
	private final Integer code;
	private final String info;

	EnumInvestMessageType(Integer code, String info) {
		this.code = code;
		this.info = info;
	}

	@JsonValue
	public Integer getCode() {
		return code;
	}

	public String getInfo() {
		return info;
	}
}
