package com.simuwang.base.common.enums;

import cn.hutool.core.util.StrUtil;

import java.util.Arrays;

/**
 * @author wangzaijun
 * @date 2024/9/29 10:57
 * @description 解析文件格式类型，支持调用python接口解析
 */
public enum ReportParserFileType {
    PDF("pdf"),
    DOCX("docx"),
    DOC("doc"),
    XLSX("xlsx"),
    XLS("xls"),
    PYTHON("python");

    private final String suffix;

    ReportParserFileType(String suffix) {
        this.suffix = suffix;
    }

    public static ReportParserFileType getBySuffix(String suffix) {
        return Arrays.stream(ReportParserFileType.values())
                .filter(e -> StrUtil.equals(e.getSuffix(), suffix)).findFirst().orElse(null);
    }

    public String getSuffix() {
        return suffix;
    }
}
