import { Inject, Injectable, Optional } from '@angular/core';
import { LOGGER } from '@anglr/common';
import { StaticComponentsRegister } from '../staticComponentsRegister/staticComponentsRegister.service';
import * as i0 from "@angular/core";
import * as i1 from "../staticComponentsRegister/staticComponentsRegister.service";
/**
 * Dynamic relations types provider for static components
 */
export class StaticComponentsRelationsTypesProvider {
    //######################### constructor #########################
    constructor(_componentsRegister, _logger) {
        this._componentsRegister = _componentsRegister;
        this._logger = _logger;
    }
    //######################### public methods - implementation of DynamicItemLoaderProvider #########################
    /**
     * @inheritdoc
     */
    tryToGet(source) {
        //only works with static components
        if (source.package != 'static-components') {
            return null;
        }
        this._logger?.debug('StaticComponentsRelationsTypesProvider: trying to get relations types {{@item}}', { item: { name: source.name, package: source.package } });
        const types = this._componentsRegister.types;
        if (!types) {
            return null;
        }
        return {
            default: types
        };
    }
}
StaticComponentsRelationsTypesProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: StaticComponentsRelationsTypesProvider, deps: [{ token: i1.StaticComponentsRegister }, { token: LOGGER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
StaticComponentsRelationsTypesProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: StaticComponentsRelationsTypesProvider });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: StaticComponentsRelationsTypesProvider, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: i1.StaticComponentsRegister }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [LOGGER]
                }, {
                    type: Optional
                }] }] });
//# sourceMappingURL=staticComponentsRelationsTypesProvider.service.js.map