package com.engine.salary.enums.auth;

import com.engine.salary.enums.BaseEnum;
import com.engine.salary.exception.SalaryRunTimeException;

import java.util.Objects;

/**
 * 权限验证方式
 * <p>Copyright: Copyright (c) 2024</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public enum AuthCheckTypeEnum implements BaseEnum<String> {


    TAX_EMP("TAX_EMP", "扣缴义务人和人员混合验证", 87627),
    EMP("EMP", "人员验证", 87626),
    TAX("TAX", "扣缴义务人验证", 87626),
    SOB("SOB", "账套验证", 87626);


    private String value;
    private String defaultLabel;
    private int labelId;

    AuthCheckTypeEnum(String value, String defaultLabel, int labelId) {
        this.value = value;
        this.defaultLabel = defaultLabel;
        this.labelId = labelId;
    }


    @Override
    public String getValue() {
        return value;
    }

    @Override
    public String getDefaultLabel() {
        return defaultLabel;
    }

    @Override
    public Integer getLabelId() {
        return labelId;
    }

    public static AuthCheckTypeEnum parseByValue(String value) {
        for (AuthCheckTypeEnum typeEnum : AuthCheckTypeEnum.values()) {
            if (Objects.equals(typeEnum.getValue(), value)) {
                return typeEnum;
            }
        }
        throw new SalaryRunTimeException("未找到对应的枚举");
    }
}
