import type { DefaultNodeTypes } from "@payloadcms/richtext-lexical";
import {
	type JSXConvertersFunction,
	LinkJSXConverter,
} from "@payloadcms/richtext-lexical/react";
import { headingConverter } from "./headings";
import { internalDocToHref } from "./internal-link";

type NodeTypes = DefaultNodeTypes;

// Insert blocks like:
//	| SerializedBlockNode<TableOfContentsProps | ContentWithMediaProps>;

export const jsxConverter: JSXConvertersFunction<NodeTypes> = ({
	defaultConverters,
}) => ({
	...defaultConverters,
	...LinkJSXConverter({ internalDocToHref }),
	...headingConverter,
	blocks: {
		/* 	contentWithMedia: ({ node }) => <ContentWithMedia {...node.fields} />,
		tableOfContents: ({ node }) => <TableOfContents {...node.fields} />,
	 */
	},
});
