package com.ff.base.enums;

import com.ff.base.exception.base.BaseException;
import com.ff.base.utils.MessageUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 代理模式类型
 *
 * @author shang
 */

@Getter
@AllArgsConstructor
public enum AgentModelType {
    ONE_LEVEL_PROFIT(1, "一级净盈利"),
    THREE_LEVEL_PROFIT(2, "三级净盈利"),
    GLOBAL_AGENT(3, "全民代理"),
	UNLIMITED(4, "无限极差"),
	ONE_LEVEL_AGENT(5, "一级代理");

    private final Integer code;
    private final String info;

    public static AgentModelType getAgentModelTypeByCode(Integer code)
    {
        for (AgentModelType item : AgentModelType.values()) {
            if(item.getCode().equals(code)) {
                return item;
            }
        }
        throw new BaseException(MessageUtils.message("agent.agentmode.enum.not.exists"));
    }

}
