package cn.axzo.workflow.common.enums;

import java.util.Arrays;
import java.util.Objects;

/**
 * 文档类型枚举
 *
 * @author wangli
 * @since 2025-03-27 09:55
 */
public enum FileTypeEnum {
    WORD("word", "文本", ".docx"),
    EXCEL("excel", "表格", ".xlsx"),
    HIPRINT("hiprint", "智能文档", ""),
    PDF("pdf", "PDF", ".pdf"),
    ;
    private final String type;
    private final String desc;
    private final String suffix;

    FileTypeEnum(String type, String desc, String suffix) {
        this.type = type;
        this.desc = desc;
        this.suffix = suffix;
    }

    public String getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public String getSuffix() {
        return suffix;
    }

    public static FileTypeEnum valueOfType(String type) {
        return Arrays.stream(FileTypeEnum.values())
                .filter(i -> Objects.equals(i.getType().toUpperCase(), type.toUpperCase()))
                .findAny()
                .orElse(null);
    }
}
