import { Directive, Inject, inject, Injector } from '@angular/core';
import { SCOPE_ID } from '@anglr/dynamic';
import { RelationsChangeDetector, RelationsComponentManager, RelationsProcessor } from '../../services';
import * as i0 from "@angular/core";
import * as i1 from "../../services";
/**
 * Creates scoped relations component manager and processor
 */
export class ScopedRelationsSADirective {
    //######################### constructor #########################
    constructor(componentManager, relationsProcessor, scopeId) {
        this.componentManager = componentManager;
        this.relationsProcessor = relationsProcessor;
        this.scopeId = scopeId;
    }
    //######################### public methods - implementation of OnDestroy #########################
    /**
     * Called when component is destroyed
     */
    ngOnDestroy() {
        this.componentManager.ngOnDestroy();
        this.relationsProcessor.destroyScope();
    }
}
ScopedRelationsSADirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ScopedRelationsSADirective, deps: [{ token: i1.RelationsComponentManager }, { token: i1.RelationsProcessor }, { token: SCOPE_ID }], target: i0.ɵɵFactoryTarget.Directive });
ScopedRelationsSADirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.4", type: ScopedRelationsSADirective, isStandalone: true, selector: "[scopedRelations]", providers: [
        {
            provide: RelationsComponentManager,
            useFactory: () => inject(RelationsComponentManager, { skipSelf: true }).openScope(inject(SCOPE_ID))
        },
        {
            provide: RelationsProcessor,
            useFactory: () => inject(RelationsProcessor, { skipSelf: true }).openScope(inject(SCOPE_ID), inject(RelationsComponentManager), inject(Injector))
        },
        RelationsChangeDetector,
    ], ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: ScopedRelationsSADirective, decorators: [{
            type: Directive,
            args: [{
                    selector: '[scopedRelations]',
                    standalone: true,
                    providers: [
                        {
                            provide: RelationsComponentManager,
                            useFactory: () => inject(RelationsComponentManager, { skipSelf: true }).openScope(inject(SCOPE_ID))
                        },
                        {
                            provide: RelationsProcessor,
                            useFactory: () => inject(RelationsProcessor, { skipSelf: true }).openScope(inject(SCOPE_ID), inject(RelationsComponentManager), inject(Injector))
                        },
                        RelationsChangeDetector,
                    ],
                }]
        }], ctorParameters: () => [{ type: i1.RelationsComponentManager }, { type: i1.RelationsProcessor }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [SCOPE_ID]
                }] }] });
//# sourceMappingURL=scopedRelations.directive.js.map