export const MONACO_LANGUAGE_BY_ATHAS_ID: Record<string, string> = {
  angular: "html",
  bash: "shell",
  c: "c",
  cpp: "cpp",
  csharp: "csharp",
  css: "css",
  dart: "dart",
  diff: "diff",
  dockerfile: "dockerfile",
  dotenv: "plaintext",
  elixir: "elixir",
  elisp: "elisp",
  elm: "elm",
  gitattributes: "gitattributes",
  gitignore: "gitignore",
  go: "go",
  graphql: "graphql",
  html: "html",
  java: "java",
  javascript: "javascript",
  json: "json",
  jsonc: "json",
  kotlin: "kotlin",
  less: "less",
  lua: "lua",
  lockfile: "lockfile",
  markdown: "markdown",
  nix: "plaintext",
  objc: "objective-c",
  ocaml: "ocaml",
  php: "php",
  protobuf: "protobuf",
  python: "python",
  ql: "sql",
  rescript: "javascript",
  ruby: "ruby",
  rust: "rust",
  sass: "scss",
  scala: "scala",
  scheme: "scheme",
  scss: "scss",
  solidity: "sol",
  sql: "sql",
  svelte: "html",
  swift: "swift",
  systemrdl: "plaintext",
  terraform: "hcl",
  tla: "plaintext",
  toml: "toml",
  typescriptreact: "typescript",
  typescript: "typescript",
  vue: "html",
  xml: "xml",
  yaml: "yaml",
  zig: "zig",
};

export const MONACO_HIGHLIGHT_LANGUAGE_IDS = new Set(
  Object.values(MONACO_LANGUAGE_BY_ATHAS_ID).filter((languageId) => languageId !== "plaintext"),
);

export function toMonacoLanguageId(languageId: string | null | undefined): string {
  if (!languageId) return "plaintext";
  return MONACO_LANGUAGE_BY_ATHAS_ID[languageId] ?? languageId;
}
