package com.ruoyi.project.business.enums;

import com.ruoyi.common.exception.ServiceErrorException;
import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum AuditorTypeEnum {

    /**
     * 1-用户 2-角色 3-上级销售 4-区总
     */
    USER(1),
    ROLE(2),
    SUPERIOR_SALES(3),
    REGIONAL_MANAGER(4);

    private Integer value;

    public static AuditorTypeEnum from(Integer value) {
        for (AuditorTypeEnum auditFlowEnum : values()) {
            if (auditFlowEnum.getValue().equals(value)) {
                return auditFlowEnum;
            }
        }
        throw new ServiceErrorException("非法的审批类型");
    }
}
