import {
  createMdxComponents,
  type MdxComponentMap,
  AccordionsMdx,
  AccordionMdx,
  CardsMdx,
  ChangesMdx,
  CodeBlock,
  FileMdx,
  FilesMdx,
  FolderMdx,
  KbdMdx,
  NoteMdx,
  ReleaseMdx,
  StepsMdx,
  StepMdx,
  TabMdx,
  TabsMdx,
  TableBodyMdx,
  TableCellMdx,
  TableFooterMdx,
  TableHeadMdx,
  TableHeaderMdx,
  TableMdx,
  TableRowMdx,
  TooltipMdx,
  YoutubeMdx,
} from "@docubook/mdx-content";
import { ImageMdx, LinkMdx, ButtonMdx, CardMdx } from "@docubook/mdx-content/next";
import { customMdxComponents } from "@/lib/mdx";

const builtInOverrides: MdxComponentMap = {
  Tabs: TabsMdx,
  Tab: TabMdx,
  table: TableMdx,
  thead: TableHeaderMdx,
  tbody: TableBodyMdx,
  tfoot: TableFooterMdx,
  tr: TableRowMdx,
  th: TableHeadMdx,
  td: TableCellMdx,
  pre: CodeBlock,
  Button: ButtonMdx,
  Note: NoteMdx,
  Step: StepMdx,
  Steps: StepsMdx,
  Accordion: AccordionMdx,
  Accordions: AccordionsMdx,
  Card: CardMdx,
  Cards: CardsMdx,
  Kbd: KbdMdx,
  Release: ReleaseMdx,
  Changes: ChangesMdx,
  File: FileMdx,
  Files: FilesMdx,
  Folder: FolderMdx,
  Youtube: YoutubeMdx,
  Tooltip: TooltipMdx,
  img: ImageMdx,
  a: LinkMdx,
  Link: LinkMdx,
};

export const mdxComponents = createMdxComponents({
  ...builtInOverrides,
  ...customMdxComponents,
});
