package api.common.pojo.enums;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum SceneEvaluationEnum {

    S_LEVEL("S", "90"),
    AA_LEVEL("AA", "85"),
    A_LEVEL("A", "80"),
    B_LEVEL("B", "70"),
    C_LEVEL("C", "60");

    private String level;

    private String levelValue;

    SceneEvaluationEnum(String level, String levelValue) {
        this.level = level;
        this.levelValue = levelValue;
    }

    public static String matchLevelEnumByLevelValue(String levelValue) {
        if (Objects.isNull(levelValue)) {
            return null;
        }
        for (SceneEvaluationEnum enums : SceneEvaluationEnum.values()) {
            if (enums.getLevelValue().equals(levelValue)) {
                return enums.getLevel();
            }
        }
        return null;
    }

    public static String matchLevelEnumByLevel(String level) {
        if (Objects.isNull(level)) {
            return null;
        }
        for (SceneEvaluationEnum enums : SceneEvaluationEnum.values()) {
            if (enums.getLevel().equals(level)) {
                return enums.getLevelValue();
            }
        }
        return null;
    }
}
