from .module_imports import *
MIME_TYPES = {
    'image': {
        '.jpg':   'image/jpeg',
        '.jpeg':  'image/jpeg',
        '.png':   'image/png',
        '.gif':   'image/gif',
        '.bmp':   'image/bmp',
        '.tiff':  'image/tiff',
        '.webp':  'image/webp',
        '.svg':   'image/svg+xml',
        '.ico':   'image/vnd.microsoft.icon',
        '.heic':  'image/heic',
        '.psd':   'image/vnd.adobe.photoshop',
        '.raw':   'image/x-raw',
    },
    'video': {
        '.mp4':   'video/mp4',
        '.webm':  'video/webm',
        '.ogg':   'video/ogg',
        '.mov':   'video/quicktime',
        '.avi':   'video/x-msvideo',
        '.mkv':   'video/x-matroska',
        '.flv':   'video/x-flv',
        '.wmv':   'video/x-ms-wmv',
        '.3gp':   'video/3gpp',
        '.ts':    'video/mp2t',
        '.mpeg':  'video/mpeg',
        '.mpg':   'video/mpg'
    },
    'audio': {
        '.mp3':   'audio/mpeg',
        '.wav':   'audio/wav',
        '.flac':  'audio/flac',
        '.aac':   'audio/aac',
        '.ogg':   'audio/ogg',
        '.m4a':   'audio/mp4',
        '.opus':  'audio/opus',
    },
    'document': {
        '.pdf':   'application/pdf',
        '.doc':   'application/msword',
        '.docx':  'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
        '.odt':   'application/vnd.oasis.opendocument.text',
        '.txt':   'text/plain',
        '.rtf':   'application/rtf',
        '.md':    'text/markdown',
        '.markdown': 'text/markdown',
        '.tex':   'application/x-tex',
        '.log':   'text/plain',
        '.json':  'application/json',
        '.xml':   'application/xml',
        '.yaml':  'application/x-yaml',
        '.yml':   'application/x-yaml',
        '.ini':   'text/plain',
        '.cfg':   'text/plain',
        '.toml':  'application/toml',
        '.csv':   'text/csv',
        '.tsv':   'text/tab-separated-values'
    },
    'presentation': {
        '.ppt':   'application/vnd.ms-powerpoint',
        '.pptx':  'application/vnd.openxmlformats-officedocument.presentationml.presentation',
        '.odp':   'application/vnd.oasis.opendocument.presentation',
    },
    'spreadsheet': {
        '.xls':   'application/vnd.ms-excel',
        '.xlsx':  'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
        '.ods':   'application/vnd.oasis.opendocument.spreadsheet',
        '.csv':   'text/csv',
        '.tsv':   'text/tab-separated-values'
    },
    'code': {
        '.py':    'text/x-python',
        '.java':  'text/x-java-source',
        '.c':     'text/x-c',
        '.cpp':   'text/x-c++',
        '.h':     'text/x-c',
        '.hpp':   'text/x-c++',
        '.js':    'application/javascript',
        '.cjs':   'application/javascript',
        '.mjs':   'application/javascript',
        '.jsx':   'application/javascript',
        '.ts':    'application/typescript',
        '.tsx':   'application/typescript',
        '.rb':    'text/x-ruby',
        '.php':   'application/x-php',
        '.go':    'text/x-go',
        '.rs':    'text/rust',
        '.swift': 'text/x-swift',
        '.kt':    'text/x-kotlin',
        '.sh':    'application/x-shellscript',
        '.bash':  'application/x-shellscript',
        '.ps1':   'application/x-powershell',
        '.sql':   'application/sql',
        '.yml':   'application/x-yaml',
        '.coffee':'text/coffeescript',
        '.lua':   'text/x-lua',
    },
    'archive': {
        '.zip':   'application/zip',
        '.tar':   'application/x-tar',
        '.gz':    'application/gzip',
        '.tgz':   'application/gzip',
        '.bz2':   'application/x-bzip2',
        '.xz':    'application/x-xz',
        '.rar':   'application/vnd.rar',
        '.7z':    'application/x-7z-compressed',
        '.iso':   'application/x-iso9660-image',
        '.dmg':   'application/x-apple-diskimage',
        '.jar':   'application/java-archive',
        '.war':   'application/java-archive',
        '.whl':   'application/python-wheel',
        '.egg':   'application/python-egg',
    },
    'font': {
        '.ttf':   'font/ttf',
        '.otf':   'font/otf',
        '.woff':  'font/woff',
        '.woff2': 'font/woff2',
        '.eot':   'application/vnd.ms-fontobject'
    },
    'executable': {
        '.exe':   'application/vnd.microsoft.portable-executable',
        '.dll':   'application/vnd.microsoft.portable-executable',
        '.bin':   'application/octet-stream',
        '.deb':   'application/vnd.debian.binary-package',
        '.rpm':   'application/x-rpm'
    }
}

# And just the sets, if you only need to test ext‐membership:
MEDIA_TYPES = make_key_map(MIME_TYPES)

