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 AuthFilterTypeEnum implements BaseEnum<String> {

    DATA_OPT("DATA_OPT", "数据&功能权限", 87626),
    QUERY_DATA("QUERY_DATA", "获取可查询数据", 87627),
    ADMIN_DATA("ADMIN_DATA", "获取可管理数据", 87627),
    NO_AUTH("ADMIN_DATA", "获取可管理数据", 87627);



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

    AuthFilterTypeEnum(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 AuthFilterTypeEnum parseByValue(String value) {
        for (AuthFilterTypeEnum typeEnum : AuthFilterTypeEnum.values()) {
            if (Objects.equals(typeEnum.getValue(), value)) {
                return typeEnum;
            }
        }
        throw new SalaryRunTimeException("未找到对应的枚举");
    }
}
