package com.smppw.modaq.common.enums;

import cn.hutool.core.util.StrUtil;
import com.smppw.modaq.common.conts.Constants;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author wangzaijun
 * @date 2024/9/29 10:57
 * @description 解析文件格式类型，支持调用python接口解析
 */
@Getter
public enum ReportParserFileType {
    PDF(Constants.FILE_PDF),
    WORD(Constants.FILE_DOCX),
    IMG(Constants.FILE_PNG + "," + Constants.FILE_JPG),
//    EXCEL("xlsx,xls"),
//    PYTHON("python");
    AI("ai");

    private final String suffix;

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

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