package com.yizhi.application.util;

import com.yizhi.documents.application.enums.DocumentType;
import org.springframework.stereotype.Component;


@Component
public class WebWorkUtil {

    public  Integer fileType(String suffixName) {

        if (suffixName.equalsIgnoreCase("pdf") || suffixName.equalsIgnoreCase("doc") || suffixName.equalsIgnoreCase("xlsx")
                || suffixName.equalsIgnoreCase("xls") || suffixName.equalsIgnoreCase("ppt")
                || suffixName.equalsIgnoreCase("pptx") || suffixName.equalsIgnoreCase("docx")) {

            return DocumentType.DOCUMENT.getType();
        }

        if (suffixName.equalsIgnoreCase("bmp") || suffixName.equalsIgnoreCase("jpg") || suffixName.equalsIgnoreCase("png") || suffixName.equalsIgnoreCase("tif")
                || suffixName.equalsIgnoreCase("gif") || suffixName.equalsIgnoreCase("pcx") || suffixName.equalsIgnoreCase("tga")
                || suffixName.equalsIgnoreCase("exif") || suffixName.equalsIgnoreCase("fpx") || suffixName.equalsIgnoreCase("svg")
                || suffixName.equalsIgnoreCase("psd") || suffixName.equalsIgnoreCase("cdr") || suffixName.equalsIgnoreCase("pcd")
                || suffixName.equalsIgnoreCase("dxf") || suffixName.equalsIgnoreCase("ufo") || suffixName.equalsIgnoreCase("eps")
                || suffixName.equalsIgnoreCase("ai") || suffixName.equalsIgnoreCase("raw") || suffixName.equalsIgnoreCase("WMF")
                || suffixName.equalsIgnoreCase("webp")|| suffixName.equalsIgnoreCase("jpeg")) {

            return DocumentType.PICTURE.getType();
        }

        if (suffixName.equalsIgnoreCase("mp3") || suffixName.equalsIgnoreCase("wma") || suffixName.equalsIgnoreCase("wav")
                || suffixName.equalsIgnoreCase("mp3pro") || suffixName.equalsIgnoreCase("cd") || suffixName.equalsIgnoreCase("wave")
                || suffixName.equalsIgnoreCase("aiff") || suffixName.equalsIgnoreCase("mpeg") || suffixName.equalsIgnoreCase("mpeg-4")
                || suffixName.equalsIgnoreCase("midi") || suffixName.equalsIgnoreCase("RealAudio") || suffixName.equalsIgnoreCase("VQF")
                || suffixName.equalsIgnoreCase("OggVorbis") || suffixName.equalsIgnoreCase("AMR") || suffixName.equalsIgnoreCase("APE")
                || suffixName.equalsIgnoreCase("FLAC") || suffixName.equalsIgnoreCase("AAC") || suffixName.equalsIgnoreCase("ogg")
                || suffixName.equalsIgnoreCase("flac") || suffixName.equalsIgnoreCase("aac")) {
            return DocumentType.AUDIO.getType();
        }

        if (suffixName.equalsIgnoreCase("mp4") || suffixName.equalsIgnoreCase("avi") || suffixName.equalsIgnoreCase("mov") || suffixName.equalsIgnoreCase("flv")
                || suffixName.equalsIgnoreCase("mvb") || suffixName.equalsIgnoreCase("MPEG") || suffixName.equalsIgnoreCase("ASF")
                || suffixName.equalsIgnoreCase("3GP") || suffixName.equalsIgnoreCase("MKV") || suffixName.equalsIgnoreCase("F4V")
                || suffixName.equalsIgnoreCase("RMVB") || suffixName.equalsIgnoreCase("RM") || suffixName.equalsIgnoreCase("MOV")
                || suffixName.equalsIgnoreCase("QT") || suffixName.equalsIgnoreCase("NAVI") || suffixName.equalsIgnoreCase("DivX")
                || suffixName.equalsIgnoreCase("MPG") || suffixName.equalsIgnoreCase("DAT") || suffixName.equalsIgnoreCase("rm")
                || suffixName.equalsIgnoreCase("vob") || suffixName.equalsIgnoreCase("rmvb") || suffixName.equalsIgnoreCase("mkv")
                || suffixName.equalsIgnoreCase("f4v") || suffixName.equalsIgnoreCase("3gp") || suffixName.equalsIgnoreCase("wmv")
                || suffixName.equalsIgnoreCase("vob")) {
            return DocumentType.VIDEO.getType();
        }

        return DocumentType.OTHER.getType();

    }
}
