import { __awaiter } from "tslib";
import { Inject, Injectable, Optional } from '@angular/core';
import { LOGGER } from '@anglr/common';
import * as i0 from "@angular/core";
/**
 * Dynamic module relations types provider, for rest types
 */
export class RestDynamicModuleRelationsProvider {
    //######################### constructor #########################
    constructor(_logger) {
        this._logger = _logger;
    }
    //######################### public methods - implementation of DynamicItemLoaderProvider #########################
    /**
     * @inheritdoc
     */
    tryToGet(source) {
        var _a, _b;
        return __awaiter(this, void 0, void 0, function* () {
            try {
                (_a = this._logger) === null || _a === void 0 ? void 0 : _a.debug('RestDynamicModuleRelationsProvider: trying to get relations types for module {{@module}}', { module: { moduleName: source.package } });
                switch (source.package) {
                    case 'rest-components':
                        return yield import('../../relations');
                    default:
                        return null;
                }
            }
            catch (e) {
                (_b = this._logger) === null || _b === void 0 ? void 0 : _b.debug('RestDynamicModuleRelationsProvider: module {{@module}} was not found, reason: ' + e, { module: { moduleName: source.package } });
            }
            return null;
        });
    }
}
RestDynamicModuleRelationsProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: RestDynamicModuleRelationsProvider, deps: [{ token: LOGGER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
RestDynamicModuleRelationsProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: RestDynamicModuleRelationsProvider });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: RestDynamicModuleRelationsProvider, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [LOGGER]
                }, {
                    type: Optional
                }] }] });
//# sourceMappingURL=restDynamicModuleRelationsProvider.service.js.map