export const inDebug = true

export function downloadFile(file: string, name?: string) {
  window.open(file)
  // const a = document.createElement('a')
  // a.href = file
  // a.download = name ?? file
  // a.click()
}

export function getFileType(ext: string) {
  if (['doc', 'docx'].includes(ext)) {
    return 'doc'
  }
  if (['xls', 'xlsx'].includes(ext)) {
    return 'xls'
  }
  if (['ppt', 'pptx'].includes(ext)) {
    return 'ppt'
  }
  if (['pdf'].includes(ext)) {
    return 'pdf'
  }
  if (['jpg', 'jpeg', 'png', 'gif', 'bmp'].includes(ext)) {
    return 'image'
  }
  if (['mp4', 'avi', 'rmvb', 'rm', 'asf', 'divx', 'mpg', 'mpeg', 'mpe', 'wmv', 'mkv', 'vob'].includes(ext)) {
    return 'video'
  }
  if (['mp3', 'wma', 'wav', 'midi', 'ape', 'flac', 'aac', 'ogg', 'm4a'].includes(ext)) {
    return 'music'
  }
  return 'unknow'
}
