import { inject, Optional } from '@angular/core';
import { DynamicItemLoader, DynamicModuleDataExtractor } from '@anglr/dynamic';
import { LOGGER } from '@anglr/common';
import { RELATIONS_COMPONENTS_LOADER, RELATIONS_COMPONENTS_MODULE_DATA_EXTRACTORS, RELATIONS_COMPONENTS_MODULE_PROVIDERS } from './tokens';
import { relationsExportExtractor } from './extractors';
import { isRelationsComponentDef } from './utils';
/**
 * Provider for default relations components extractor
 */
export const DEFAULT_RELATIONS_COMPONENTS_EXTRACTOR = {
    provide: RELATIONS_COMPONENTS_MODULE_DATA_EXTRACTORS,
    useFactory: (logger) => {
        return new DynamicModuleDataExtractor([
            relationsExportExtractor,
        ], logger);
    },
    deps: [[new Optional(), LOGGER]],
    multi: true
};
/**
 * Provider for relations components loader
 */
export const RELATIONS_COMPONENTS_LOADER_PROVIDER = {
    provide: RELATIONS_COMPONENTS_LOADER,
    useFactory: () => {
        var _a;
        return new DynamicItemLoader(inject(RELATIONS_COMPONENTS_MODULE_PROVIDERS), inject(RELATIONS_COMPONENTS_MODULE_DATA_EXTRACTORS), isRelationsComponentDef, (_a = inject(LOGGER, { optional: true })) !== null && _a !== void 0 ? _a : undefined);
    }
};
//# sourceMappingURL=providers.js.map