package com.engine.salary.enums.salaryformula;

import java.util.Arrays;
import java.util.Objects;

public enum ReferenceTypeEnum {
    FORMULA("formula", "公式"),
    SQL("sql", "SQL"),
    BackCalc("backCalc", "回算");

    private String value;

    private String label;

    ReferenceTypeEnum(String value, String label) {
        this.value = value;
        this.label = label;
    }

    public String getValue() {
        return value;
    }

    public String getLabel() {
        return label;
    }


    public static ReferenceTypeEnum parseByValue(String value) {
        return Arrays.stream(ReferenceTypeEnum.values()).filter(typeEnum -> Objects.equals(typeEnum.getValue(), value)).findFirst().orElse(null);
    }
}
