import { createGrammarConfig } from "./languages/grammar-config.js";
import { LangiumParserErrorMessageProvider } from "./parser/langium-parser.js";
import { createCompletionParser } from "./parser/completion-parser-builder.js";
import { createLangiumParser } from "./parser/langium-parser-builder.js";
import { DefaultTokenBuilder } from "./parser/token-builder.js";
import { DefaultValueConverter } from "./parser/value-converter.js";
import { DefaultLangiumDocumentFactory, DefaultLangiumDocuments } from "./workspace/documents.js";
import { DefaultLinker } from "./references/linker.js";
import { DefaultNameProvider } from "./references/name-provider.js";
import { DefaultReferences } from "./references/references.js";
import { DefaultScopeComputation } from "./references/scope-computation.js";
import { DefaultScopeProvider } from "./references/scope-provider.js";
import { DefaultJsonSerializer } from "./serializer/json-serializer.js";
import { DefaultServiceRegistry } from "./service-registry.js";
import { ValidationRegistry } from "./validation/validation-registry.js";
import { DefaultDocumentValidator } from "./validation/document-validator.js";
import { DefaultAstNodeDescriptionProvider, DefaultReferenceDescriptionProvider } from "./workspace/ast-descriptions.js";
import { DefaultAstNodeLocator } from "./workspace/ast-node-locator.js";
import { DefaultConfigurationProvider } from "./workspace/configuration.js";
import { DefaultDocumentBuilder } from "./workspace/document-builder.js";
import { DefaultIndexManager } from "./workspace/index-manager.js";
import { DefaultWorkspaceManager } from "./workspace/workspace-manager.js";
import { DefaultLexer, DefaultLexerErrorMessageProvider } from "./parser/lexer.js";
import { JSDocDocumentationProvider } from "./documentation/documentation-provider.js";
import { DefaultCommentProvider } from "./documentation/comment-provider.js";
import { DefaultAsyncParser } from "./parser/async-parser.js";
import { DefaultWorkspaceLock } from "./workspace/workspace-lock.js";
import { DefaultHydrator } from "./serializer/hydrator.js";
function createDefaultCoreModule(M) {
	return {
		documentation: {
			CommentProvider: (m) => new DefaultCommentProvider(m),
			DocumentationProvider: (m) => new JSDocDocumentationProvider(m)
		},
		parser: {
			AsyncParser: (m) => new DefaultAsyncParser(m),
			GrammarConfig: (j) => createGrammarConfig(j),
			LangiumParser: (m) => createLangiumParser(m),
			CompletionParser: (m) => createCompletionParser(m),
			ValueConverter: () => new DefaultValueConverter(),
			TokenBuilder: () => new DefaultTokenBuilder(),
			Lexer: (m) => new DefaultLexer(m),
			ParserErrorMessageProvider: () => new LangiumParserErrorMessageProvider(),
			LexerErrorMessageProvider: () => new DefaultLexerErrorMessageProvider()
		},
		workspace: {
			AstNodeLocator: () => new DefaultAstNodeLocator(),
			AstNodeDescriptionProvider: (m) => new DefaultAstNodeDescriptionProvider(m),
			ReferenceDescriptionProvider: (m) => new DefaultReferenceDescriptionProvider(m)
		},
		references: {
			Linker: (m) => new DefaultLinker(m),
			NameProvider: () => new DefaultNameProvider(),
			ScopeProvider: (m) => new DefaultScopeProvider(m),
			ScopeComputation: (m) => new DefaultScopeComputation(m),
			References: (m) => new DefaultReferences(m)
		},
		serializer: {
			Hydrator: (m) => new DefaultHydrator(m),
			JsonSerializer: (m) => new DefaultJsonSerializer(m)
		},
		validation: {
			DocumentValidator: (m) => new DefaultDocumentValidator(m),
			ValidationRegistry: (m) => new ValidationRegistry(m)
		},
		shared: () => M.shared
	};
}
function createDefaultSharedCoreModule(m) {
	return {
		ServiceRegistry: (m) => new DefaultServiceRegistry(m),
		workspace: {
			LangiumDocuments: (m) => new DefaultLangiumDocuments(m),
			LangiumDocumentFactory: (m) => new DefaultLangiumDocumentFactory(m),
			DocumentBuilder: (m) => new DefaultDocumentBuilder(m),
			IndexManager: (m) => new DefaultIndexManager(m),
			WorkspaceManager: (m) => new DefaultWorkspaceManager(m),
			FileSystemProvider: (j) => m.fileSystemProvider(j),
			WorkspaceLock: () => new DefaultWorkspaceLock(),
			ConfigurationProvider: (m) => new DefaultConfigurationProvider(m)
		},
		profilers: {}
	};
}
export { createDefaultCoreModule, createDefaultSharedCoreModule };
