/**
 * MIME types and file extensions that are known to be plaintext-decodable.
 * Any file matching these is safe to decode from base64 → UTF-8 and include
 * directly in the LLM prompt. This list covers code, config, markup, data,
 * and document formats that are fundamentally text.
 */

export const TEXT_MIME_PREFIXES = [
  'text/',
  'application/json',
  'application/xml',
  'application/javascript',
  'application/typescript',
  'application/x-sh',
  'application/x-yaml',
  'application/yaml',
  'application/toml',
  'application/x-toml',
  'application/sql',
  'application/graphql',
  'application/x-httpd-php',
  'application/x-python',
  'application/x-ruby',
  'application/x-perl',
  'application/x-lua',
  'application/x-latex',
  'application/x-tex',
  'application/rtf',
  'application/xhtml+xml',
  'application/atom+xml',
  'application/rss+xml',
  'application/soap+xml',
  'application/mathml+xml',
  'application/svg+xml',
  'application/ld+json',
  'application/vnd.api+json',
  'application/x-ndjson',
  'application/schema+json',
] as const;

export const TEXT_FILE_EXTENSIONS = new Set([
  '.txt',
  '.text',
  '.md',
  '.markdown',
  '.rst',
  '.adoc',
  '.org',
  '.rtf',
  '.csv',
  '.tsv',
  '.tab',
  '.json',
  '.jsonl',
  '.ndjson',
  '.xml',
  '.xsd',
  '.xsl',
  '.xslt',
  '.dtd',
  '.yaml',
  '.yml',
  '.toml',
  '.ini',
  '.cfg',
  '.conf',
  '.properties',
  '.env',
  '.dotenv',
  '.plist',
  '.html',
  '.htm',
  '.xhtml',
  '.css',
  '.scss',
  '.sass',
  '.less',
  '.styl',
  '.sql',
  '.graphql',
  '.gql',
  '.proto',
  '.thrift',
  '.avdl',
  '.c',
  '.h',
  '.cpp',
  '.cc',
  '.cxx',
  '.hpp',
  '.hxx',
  '.m',
  '.mm',
  '.java',
  '.kt',
  '.scala',
  '.groovy',
  '.gradle',
  '.js',
  '.mjs',
  '.cjs',
  '.jsx',
  '.ts',
  '.mts',
  '.cts',
  '.tsx',
  '.vue',
  '.svelte',
  '.astro',
  '.py',
  '.pyw',
  '.rb',
  '.erb',
  '.go',
  '.rs',
  '.r',
  '.jl',
  '.lua',
  '.pl',
  '.pm',
  '.sh',
  '.bash',
  '.zsh',
  '.fish',
  '.ps1',
  '.bat',
  '.cmd',
  '.swift',
  '.dart',
  '.php',
  '.phtml',
  '.cs',
  '.fs',
  '.vb',
  '.vba',
  '.hs',
  '.lhs',
  '.ml',
  '.mli',
  '.ex',
  '.exs',
  '.erl',
  '.hrl',
  '.clj',
  '.cljs',
  '.lisp',
  '.el',
  '.zig',
  '.nim',
  '.d',
  '.asm',
  '.s',
  '.nasm',
  '.sol',
  '.move',
  '.ada',
  '.ads',
  '.adb',
  '.pas',
  '.for',
  '.f90',
  '.f95',
  '.cob',
  '.makefile',
  '.mk',
  '.cmake',
  '.ninja',
  '.dockerfile',
  '.dockerignore',
  '.gitignore',
  '.gitattributes',
  '.editorconfig',
  '.npmrc',
  '.yarnrc',
  '.eslintrc',
  '.prettierrc',
  '.babelrc',
  '.stylelintrc',
  '.prisma',
  '.pom',
  '.sln',
  '.csproj',
  '.vbproj',
  '.log',
  '.diff',
  '.patch',
  '.srt',
  '.vtt',
  '.sub',
  '.ass',
  '.ssa',
  '.lrc',
  '.svg',
  '.tex',
  '.latex',
  '.bib',
  '.lock',
  '.map',
  '.manifest',
  '.webmanifest',
] as const);

export const DOCUMENT_MIME_PDF = 'application/pdf';
export const DOCUMENT_MIME_DOCX =
  'application/vnd.openxmlformats-officedocument.wordprocessingml.document';

export const IMAGE_MIME_PREFIX = 'image/';

export const MAX_FILE_CONTENT_LENGTH = 100_000;
