import { Inject, Injectable, Optional } from '@angular/core';
import { LOGGER } from '@anglr/common';
import * as i0 from "@angular/core";
/**
 * Dynamic module items provider for basic module items
 */
export class BasicDynamicModuleItemsProvider {
    //######################### constructor #########################
    constructor(_logger) {
        this._logger = _logger;
    }
    //######################### public methods - implementation of DynamicItemLoaderProvider #########################
    /**
     * @inheritdoc
     */
    async tryToGet(source) {
        switch (source.package) {
            case 'basic-components':
                {
                    try {
                        this._logger?.debug('BasicDynamicModuleItemsProvider: trying to get item {{@item}}', { item: { name: source.name, package: source.package } });
                        const dynamicItemModule = await import(`../../dynamicItems/${source.name}/type`);
                        return dynamicItemModule;
                    }
                    catch (e) {
                        this._logger?.debug('BasicDynamicModuleItemsProvider: item {{@item}} was not found, reason: ' + e, { item: { name: source.name, package: source.package } });
                    }
                    break;
                }
            default:
                {
                    return null;
                }
        }
        return null;
    }
}
BasicDynamicModuleItemsProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: BasicDynamicModuleItemsProvider, deps: [{ token: LOGGER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
BasicDynamicModuleItemsProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: BasicDynamicModuleItemsProvider });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: BasicDynamicModuleItemsProvider, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [LOGGER]
                }, {
                    type: Optional
                }] }] });
//# sourceMappingURL=basicDynamicModuleItemsProvider.service.js.map