import { Inject, Injectable, Optional } from '@angular/core';
import { LOGGER } from '@anglr/common';
import { extend } from '@jscrpt/common';
import { LAYOUT_EDITOR_PROPERTY_METADATA_PROPERTIES } from '../../misc/tokens';
import * as i0 from "@angular/core";
/**
 * Service used for extracting property metadata
 */
export class LayoutEditorPropertyMetadataExtractor {
    //######################### constructor #########################
    constructor(_layoutPropertiesSymbols, _logger) {
        this._layoutPropertiesSymbols = _layoutPropertiesSymbols;
        this._logger = _logger;
    }
    //######################### public methods #########################
    /**
     * Extracts properties metadata from type
     * @param type - Type to be examined
     */
    extract(type) {
        if (!type) {
            return null;
        }
        this._logger?.debug(`LayoutEditorPropertyMetadataExtractor: Trying to extract properties metadata '${type.name}'`);
        const result = {};
        for (const propSymbol of this._layoutPropertiesSymbols) {
            const meta = Reflect.get(type.prototype, propSymbol);
            extend(true, result, meta);
        }
        return result;
    }
}
LayoutEditorPropertyMetadataExtractor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: LayoutEditorPropertyMetadataExtractor, deps: [{ token: LAYOUT_EDITOR_PROPERTY_METADATA_PROPERTIES }, { token: LOGGER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
LayoutEditorPropertyMetadataExtractor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: LayoutEditorPropertyMetadataExtractor });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: LayoutEditorPropertyMetadataExtractor, decorators: [{
            type: Injectable
        }], ctorParameters: () => [{ type: undefined, decorators: [{
                    type: Inject,
                    args: [LAYOUT_EDITOR_PROPERTY_METADATA_PROPERTIES]
                }] }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [LOGGER]
                }, {
                    type: Optional
                }] }] });
//# sourceMappingURL=layoutEditorPropertyMetadataExtractor.service.js.map