package boxstore

import (
	"path/filepath"
	"strings"
)

func IconForMimeType(mimeType string, filename string) string {
	extension := strings.ToLower(filepath.Ext(filename))

	switch {
	case extension == ".exe":
		return "/static/img/icons/Program Files Icons - PNG/MSONSEXT.DLL_14_6-0.png"
	case strings.HasPrefix(mimeType, "image/"):
		return "/static/img/sprites/bitmap.png"
	case strings.HasPrefix(mimeType, "video/"):
		return "/static/img/icons/netshow_notransm-1.png"
	case strings.HasPrefix(mimeType, "audio/"):
		return "/static/img/icons/netshow_notransm-1.png"
	case strings.HasPrefix(mimeType, "text/") || extension == ".md":
		return "/static/img/sprites/notepad_file-1.png"
	case strings.Contains(mimeType, "zip") || strings.Contains(mimeType, "compressed") || extension == ".rar" || extension == ".7z" || extension == ".tar" || extension == ".gz":
		return "/static/img/icons/Windows Icons - PNG/zipfldr.dll_14_101-0.png"
	case extension == ".ttf" || extension == ".otf" || extension == ".woff" || extension == ".woff2":
		return "/static/img/sprites/font.png"
	case extension == ".pdf":
		return "/static/img/sprites/journal.png"
	case extension == ".html" || extension == ".css" || extension == ".js":
		return "/static/img/sprites/frame_web-0.png"
	default:
		return "/static/img/icons/Windows Icons - PNG/ole2.dll_14_DEFICON.png"
	}
}
