package epson.common;

import epson.print.CommonDefine;

public enum MimeType {
    IMAGE_TYPE("image/jpeg"),
    PDF_TYPE("application/pdf"),
    DOC_TYPE_1(CommonDefine.DOC_TYPE_1),
    DOCX_TYPE_2(CommonDefine.DOCX_TYPE_2),
    EXCEL_TYPE_1(CommonDefine.EXCEL_TYPE_1),
    EXCEL_TYPE_2(CommonDefine.EXCEL_TYPE_2),
    POWERPOINT_TYPE_1(CommonDefine.POWERPOINT_TYPE_1),
    POWERPOINT_TYPE_2(CommonDefine.POWERPOINT_TYPE_2),
    TEXT_TYPE(CommonDefine.TEXT_TYPE),
    RTF_TYPE(CommonDefine.RTF_TYPE),
    CSV_TYPE("text/comma-separated-values"),
    HTML_TYPE(CommonDefine.HTML_TYPE),
    IMAGE_TYPE_PNG("image/png"),
    IMAGE_TYPE_BMP(CommonDefine.IMAGE_TYPE_BMP),
    IMAGE_TYPE_HEIF(CommonDefine.IMAGE_TYPE_HEIF),
    UNKNOWN_TYPE("");
    
    private final String name;

    private MimeType(String str) {
        name = str;
    }

    public String toString() {
        return name;
    }

    public static MimeType toMimeType(String str) {
        MimeType mimeType;
        MimeType[] values = values();
        int length = values.length;
        int i = 0;
        while (true) {
            if (i >= length) {
                mimeType = null;
                break;
            }
            mimeType = values[i];
            if (mimeType.toString().equals(str)) {
                break;
            }
            i++;
        }
        return mimeType != null ? mimeType : UNKNOWN_TYPE;
    }
}
