package cn.stylefeng.workflow.api.enums.condition;

import lombok.Getter;

@Getter
public enum ConditionExpressionTypeEnum {

    CONDITION("condition", ""),

    LEFT_BRACKET("left_bracket", "("),

    RIGHT_BRACKET("right_bracket", ")"),

    AND("and", "&&"),

    OR("or", "||");

    private final String code;

    private final String symbol;

    ConditionExpressionTypeEnum(String code, String symbol) {
        this.code = code;
        this.symbol = symbol;
    }

    public static ConditionExpressionTypeEnum parseToEnum(String symbol) {
        for (ConditionExpressionTypeEnum value : ConditionExpressionTypeEnum.values()) {
            if (value.getSymbol().equals(symbol)) {
                return value;
            }
        }
        return null;
    }

}
