package com.smppw.modaq.common.enums;

import cn.hutool.core.collection.ListUtil;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;

/**
 * @author wangzaijun
 * @date 2024/9/29 10:57
 * @description 解析文件格式类型，支持调用python接口解析
 */
@Getter
public enum ReportParserFileType {
    PDF("pdf"),
    WORD("docx,doc"),
    IMG("png.jpg,jpeg"),
//    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 -> e.getSuffix().contains(suffix)).findFirst().orElse(null);
    }

    public static final List<ReportParserFileType> GENERATE_PNG_FILE_TYPES = ListUtil.of(ReportParserFileType.PDF, ReportParserFileType.WORD);
}
