package tech.easyflow.ai.easyagentsflow.entity;

import tech.easyflow.common.web.exceptions.BusinessException;

import java.util.Locale;

public enum WorkflowCheckStage {
    SAVE,
    PRE_EXECUTE;

    public static WorkflowCheckStage from(String value) {
        if (value == null || value.trim().isEmpty()) {
            throw new BusinessException("校验阶段不能为空");
        }
        try {
            return WorkflowCheckStage.valueOf(value.trim().toUpperCase(Locale.ROOT));
        } catch (IllegalArgumentException e) {
            throw new BusinessException("不支持的校验阶段: " + value);
        }
    }
}
