package com.ff.base.enums;


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

/**
 * 结算周期类型
 *
 * @author shang
 */
@Getter
public enum SettleDurationType {
    SettleDurationType_1("1", "日结"),
    SettleDurationType_2("2", "周结"),
    SettleDurationType_3("3", "月结");

    private final String code;
    private final String info;

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

    public static SettleDurationType getSettleDurationTypeByCode(String code)
    {
        for (SettleDurationType item : SettleDurationType.values()) {
            if(item.getCode().equals(code)) {
                return item;
            }
        }
       throw new BaseException(MessageUtils.message("agent.settleduration.enum.not.exists"));
    }
}
