import audioImg from '@/assets/fileIcon/audio.png'
import docImg from '@/assets/fileIcon/doc.png'
import imgImg from '@/assets/fileIcon/img.png'
import otherImg from '@/assets/fileIcon/other.png'
import pdfImg from '@/assets/fileIcon/pdf.png'
import pptImg from '@/assets/fileIcon/ppt.png'
import videoImg from '@/assets/fileIcon/video.png'
import xlsxImg from '@/assets/fileIcon/xlsx.png'
import zipImg from '@/assets/fileIcon/zip.png'

export function useFileIcon(type){
    switch(type){
        case 'audio':
            return audioImg
        case 'doc':
        case 'docx':
            return docImg
        case 'img':
        case 'jpg':
        case 'png':
        case 'jpeg':
        case 'gif':
        case 'svg':
        case 'webp':
            return imgImg
        case 'pdf':
            return pdfImg
        case 'ppt':
        case 'pptx':
            return pptImg
        case 'video':
        case 'mp4':
        case 'avi':
        case 'mpg':
        case 'mpeg':
        case 'wmv':
        case 'mkv':
        case 'mov':
        case 'flv':
        case 'mpg':
            return videoImg
        case 'excel':
        case 'xlsx':
            return xlsxImg
        case 'zip':
            return zipImg
        default:
            return otherImg
    }
}


export const useFileTypeConvert = (fileName)=>{
    let suffix = fileName?.split('.').length >0 ? fileName.split('.')[fileName.split('.').length - 1] : null
    switch(suffix){
        case 'pdf':
            return 'pdf'
        case 'xlsx':
            return 'excel'
        case 'docx':
            return 'docx'
        case 'pptx':
        case 'ppt':
            return 'ppt'
        case 'mp4':
        case 'avi':
        case 'mpg':
        case 'mpeg':
        case 'wmv':
        case 'mkv':
        case 'mov':
        case 'flv':
        case 'mpg':
            return 'video'
        case 'jpg':
        case 'png':
        case 'jpeg':
        case 'gif':
        case 'svg':
        case 'webp':
            return 'img'
    }
}