/**
 * @description Determines the file type based on the filetype string.
 * @note Also needs to be updated in the mobile app utility.
 * @param filetype
 * @returns {string}
 */
const determineFileType = (filetype) => {
  if (!filetype) return "auto";
  else if (filetype.startsWith("image")) return "image";
  else if (filetype.startsWith("video")) return "video";
  else if (filetype.startsWith("application/pdf")) return "image";
  else if (filetype.startsWith("application")) return "raw";

  return "auto";
};

module.exports = determineFileType;
