package com.erp.approval.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 条件操作符枚举
 */
@Getter
@RequiredArgsConstructor
public enum ConditionOperator {
    
    EQ("eq", "等于"),
    NE("ne", "不等于"),
    GT("gt", "大于"),
    GTE("gte", "大于等于"),
    LT("lt", "小于"),
    LTE("lte", "小于等于"),
    IN("in", "在列表中"),
    NOT_IN("not_in", "不在列表中"),
    CONTAINS("contains", "包含"),
    NOT_CONTAINS("not_contains", "不包含");
    
    private final String code;
    private final String description;
    
    public static ConditionOperator fromCode(String code) {
        for (ConditionOperator op : values()) {
            if (op.code.equals(code)) {
                return op;
            }
        }
        throw new IllegalArgumentException("未知的操作符: " + code);
    }
}
