import { Observable, Subject } from 'rxjs';
import { TccODataService } from '../../odata/services/tcc-odata/tcc-odata.service';
import { TccInfinityScrollComponent } from '../components/tcc-infinity-scroll/tcc-infinity-scroll.component';
import { TccFilterbarComponent } from '../../core/components/tcc-filterbar/tcc-filterbar.component';
import { TccOdataHelperService } from '../../odata/services/tcc-odata-helper/tcc-odata-helper.service';
import { TccODataResult } from '../../odata/models/shared.model';
import { TccDialogWindowService } from '../../core/services/tcc-dialog-window/tcc-dialog-window.service';
import { TccTableCheckboxControllerDirective } from '../directives/tcc-table-checkbox-controller/tcc-table-checkbox-controller.directive';
import { TccCatchErrorService } from '../services/tcc-catch-error/tcc-catch-error.service';
import { TccMessageDispatcherService } from '../services/tcc-message-dispatcher/tcc-message-dispatcher.service';
import { TccSnackBarService } from '../../core/services/tcc-snackbar/tcc-snackbar.service';
import { tccListTileSwitch } from '../../core/components/tcc-list-tile-switch/tcc-list-tile-switch.component';
import { SortDirection } from '@angular/material/sort';
import { TccGetOrderByFields, TccGetOrderByFieldsService } from '../services/tcc-get-order-by-fields/tcc-get-order-by-fields.service';
import { TccAuthService } from '../../odata/services/tcc-auth/tcc-auth.service';
export declare namespace TccPagedDataManagerNamespace {
    enum specialSearch {
        translationElement = "tccTranslation"
    }
    interface options<T> {
        service: TccODataService<T>;
        infinityScroll?: TccInfinityScrollComponent;
        filterBar?: TccFilterbarComponent;
        entityName: entityName;
        checkDirective?: TccTableCheckboxControllerDirective<T>;
        tilesComponent?: {
            checkedCards: T[];
        };
        pageSize?: number;
        select?: string[];
        orderBy?: string;
        permanentFilter?: string;
        delete?: deleteOptions<T>;
        searchFields?: string[];
    }
    interface deleteOptions<T> {
        deleteForbidden?: (item: T) => string;
        deleteGetName?: (item: T) => string;
    }
    enum dataReturnType {
        scrollDown = "scrollDown",
        delete = "delete",
        add = "add",
        manually = "manually",
        filterChange = "filterChanged",
        orderByChange = "orderByChange",
        refresh = "refresh"
    }
    interface _options<T> extends options<T> {
        snackBar: TccSnackBarService;
        dialog: TccDialogWindowService;
        dispatcher: TccMessageDispatcherService;
        getOrderByFields: TccGetOrderByFieldsService;
        entityName: entityName;
        delete?: _deleteOptions<T>;
    }
    interface _deleteOptions<T> extends deleteOptions<T> {
        tccCatchError: TccCatchErrorService;
    }
    interface entityName {
        singular: string;
        plural: string;
    }
    interface dataReturn<T> {
        items: T[];
        deletedIds?: string[];
        refresh?: boolean;
        identifier?: any;
        type: dataReturnType;
        dataSetComplete?: boolean;
    }
    interface refreshReferencesOptions<T> {
        infinityScroll?: TccInfinityScrollComponent;
        filterBar?: TccFilterbarComponent;
        checkDirective?: TccTableCheckboxControllerDirective<T>;
    }
}
/**
 * @description Class to handle paged data, filters, searches and deletes.
 *
 * Usage:
 * - create new Object.
 * - Subscribe to data. Data will send new datasets, when they arrive. It will allways send the complete List.
 * - Use destroy function, when the pagedDataManager is no longer needed.
 */
export declare class TccPagedDataManager<T extends TccODataResult> {
    private helper;
    private authService;
    private _service;
    private _query;
    private tempQuery;
    private _queryFilter;
    private _infinityScroll;
    private _filterBar;
    private _checkDirective;
    private _tilesComponent;
    private _pageSize;
    private _permanentFilter;
    private _snackbar;
    private _dialog;
    private _dispatcher;
    private _entityName;
    displayComponent: tccListTileSwitch.view;
    private _searchFields;
    private identifier;
    private currentFilterData;
    private _currentFilter;
    private _currentSearch;
    private _lastSearchString;
    private _currentSelect;
    private orderByFields;
    private _orderBy;
    private _getOrderByService;
    private _finalFilterString;
    private _deleteForbidden;
    private _deleteGetName;
    private _tccCatchError;
    tempAllData: Array<T>;
    private allData;
    data: Subject<TccPagedDataManagerNamespace.dataReturn<T>>;
    onChangeComponentViewEvent: Subject<tccListTileSwitch.view>;
    private destroySubject;
    private get createQuery();
    get queryCount(): number;
    get allDataCount(): number;
    private get createQueryFilter();
    private get query();
    get service(): TccODataService<T>;
    constructor(options: TccPagedDataManagerNamespace._options<T>, helper: TccOdataHelperService, authService: TccAuthService);
    /**
     * @description triggers next on data with allData as content. No server request will be send.
     */
    getData(): void;
    /**
     * @description triggers next on data with allData as content. No server request will be send.
     */
    getItemByIndex(index: number): T;
    /**
     * @description refreshes the references for infinityScroll, filterBar and checkDirective. Use if these elements got destroyed and recreated. If no new references are given, the subscriptions will be renewed with the old references.
     *
     * @param {{infinityScroll: TccInfinityScrollComponent,filterBar: TccFilterbarComponent,checkDirective: TccTableCheckboxControllerDirective,}} references
     */
    refreshReferences(references?: {
        infinityScroll?: TccInfinityScrollComponent;
        filterBar?: TccFilterbarComponent;
        checkDirective?: TccTableCheckboxControllerDirective<T>;
    }): void;
    private initSubscriptions;
    /**
     * @description builds the odata filter string
     *
     * @param {tccFilter.FilterResult} filterData
     *
     * @returns true, if the new Filter differs from the old Filter
     */
    private buildFilterStr;
    /**
     * @description compares two string Arrays
     *
     * @param { Array<string>} array1
     * @param { Array<string>} array2
     *
     * @returns true, if the Arrays are identical
     */
    private compareArrays;
    /**
     * @description compares two Objects of string Arrays
     *
     * @param { {[key: string]: Array<string>} } object1
     * @param { {[key: string]: Array<string>} } object2
     *
     * @returns true, if the Objects are identical
     */
    private compareObjectOfArrays;
    /**
     * @description gets the path string to a property from the options of the filterBar
     *
     * @param {string} filterKey the filter key from the filter event
     *
     * @returns the path as string
     */
    private getFilterPath;
    /**
     * @description applies the filterString
     *
     * @returns the nextPage Observable
     */
    private setNewFilter;
    /**
     * @description builds the odata search string (odata filter will be used -> searchString gets added to the filterString)
     *
     * @param {string} searchStr
     *
     * @returns true, if the new Search differs from the old Search
     */
    private buildSearchStr;
    /**
     * @description builds the odata select string
     *
     * @param {string[]} selectArray all Fields, in wich should be selected
     *
     * @returns the selectString
     */
    private buildSelectString;
    /**
     * @description refreshes the data and loads new data. If Filters are set, the will be kept (allData will be resetted regardless).
     */
    onRefresh(): void;
    /**
     * @description manually triggers the nextPage event. Data will be emitted through the data Subject
     *
     * @param {any} identifier will be returned through the data Subject, to identify new data called from the component
     */
    getNextPage(identifier?: any): void;
    /**
     * @description builds the nextPage Observable, adds infinityScroll init functionality, if allData is empty
     *
     * @returns the nextPage Observable
     */
    private getNextPageObs;
    private initGetNextPageObsCallbackFunction;
    /**
     * @description calls init infinityScroll functionality
     *
     * @returns the nextPage Observable
     */
    private initGetNextPageObs;
    /**
     * @description handles the nextPage Observable callback and emits the data through the data Observable
     *
     * @param {T[]} newData the loaded items
     */
    private getNextPageCallback;
    /**
     * @description deletes an item or items.
     *
     * @param {string} itemId item to delete. If no id is given, the table checkDirective or the tile checkedCards will be used
     */
    onDelete(itemId?: string): void;
    getSelectedItems(): T[];
    getSelectedItemIds(): string[];
    /**
     * @description gets all item Ids, that should be deleted and opens the confirmation dialog. On confirmation deletes all elements with the given ids
     *
     * @param {string} itemId item to delete. If no id is given, the table checkDirective or the tile checkedCards will be used
     */
    private deleteItems;
    /**
     * @description creates an item. If all data of the list are allready loaded, the new Item will be added to the allData list and the data Subject will be updated.
     *
     * @param {T} item item to create
     *
     * @returns {Observable<T>} Observable, that returns the created Item
     */
    createItem(item: T): Observable<T>;
    /**
     * @description create item callback (If all data of the list are allready loaded, the new Item will be added to the allData list and the data Subject will be updated.)
     *
     * @param {T} item created item
     */
    private addCreatedItemCallback;
    setOrderBy(fields: string[], direction: SortDirection, type?: TccGetOrderByFields.type, clear?: boolean): void;
    private getOrderByStr;
    /**
     * @description unsubscribes all subscriptions
     */
    destroy(): void;
    private _destroy;
}
