import type { Injector } from '@angular/core';
import { AfterViewInit, ChangeDetectorRef, EmbeddedViewRef, EventEmitter, NgZone, OnChanges, OnDestroy, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core';
import { BaseDataSource, BaseDataSourceViewer, DataSourceLoader } from '@rxap/data-source';
import { IdOrInstanceOrToken } from '@rxap/definition';
import { Observable, Subscription } from 'rxjs';
import * as i0 from "@angular/core";
export interface DataSourceTemplateContext<Data> {
    $implicit: Data;
    connection$: Observable<Data>;
}
export interface DataSourceErrorTemplateContext {
    $implicit: unknown | null;
    refresh: () => void;
}
export declare class DataSourceDirective<Data = any> implements OnDestroy, OnChanges, AfterViewInit {
    private readonly dataSourceLoader;
    private readonly template;
    private readonly viewContainerRef;
    private readonly injector;
    private readonly cdr;
    private readonly zone;
    /**
     * Asserts the correct type of the context for the template that `NgForOf` will render.
     *
     * The presence of this method is a signal to the Ivy template type-check compiler that the
     * `NgForOf` structural directive renders its template with a specific context type.
     */
    static ngTemplateContextGuard<T>(dir: DataSourceDirective<T>, ctx: any): ctx is DataSourceTemplateContext<T>;
    dataSourceOrIdOrToken: IdOrInstanceOrToken<BaseDataSource<Data>>;
    viewer: BaseDataSourceViewer;
    errorTemplate?: TemplateRef<DataSourceErrorTemplateContext>;
    embedded: EventEmitter<Data>;
    loaded: EventEmitter<any>;
    error: EventEmitter<any>;
    dataSource: BaseDataSource<Data> | null;
    connection$: Observable<Data>;
    trackBy?: (data: Data) => any;
    /**
     * @deprecated removed
     * @protected
     */
    protected readonly subscription: Subscription;
    protected embeddedViewRef: EmbeddedViewRef<DataSourceTemplateContext<Data>> | null;
    protected embeddedErrorViewRef: EmbeddedViewRef<DataSourceErrorTemplateContext> | null;
    private _dataSourceLoadingSubscription;
    private _dataSourceConnectionSubscription;
    constructor(dataSourceLoader: DataSourceLoader, template: TemplateRef<DataSourceTemplateContext<Data>>, viewContainerRef: ViewContainerRef, injector: Injector, cdr: ChangeDetectorRef, zone: NgZone);
    ngOnChanges(changes: SimpleChanges): void;
    ngAfterViewInit(): void;
    embedErrorTemplate(error: unknown | null): void;
    embedTemplate(response: any): void;
    ngOnDestroy(): void;
    protected loadDataSource(): BaseDataSource<Data> | null;
    protected connect(): void;
    private hasChanged;
    static ɵfac: i0.ɵɵFactoryDeclaration<DataSourceDirective<any>, never>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<DataSourceDirective<any>, "[rxapDataSource]", ["rxapDataSource"], { "dataSourceOrIdOrToken": { "alias": "rxapDataSourceFrom"; "required": true; }; "viewer": { "alias": "rxapDataSourceViewer"; "required": false; }; "errorTemplate": { "alias": "rxapDataSourceErrorTemplate"; "required": false; }; "trackBy": { "alias": "rxapDataSourceTrackBy"; "required": false; }; }, { "embedded": "embedded"; "loaded": "loaded"; "error": "error"; }, never, never, true, never>;
}
