import { Observable } from 'rxjs';
import * as i3 from '@progress/kendo-angular-grid';
import { PagerSettings, GridComponent } from '@progress/kendo-angular-grid';
import * as i0 from '@angular/core';
import { OnInit, OnDestroy, AfterViewInit, ChangeDetectorRef } from '@angular/core';
import { ODataState, ODataResult, Expander } from 'imng-kendo-odata';
import * as i4 from 'imng-kendo-grid';
import { KendoGridBaseComponent, GridStateChangeEvent } from 'imng-kendo-grid';
import { Router } from '@angular/router';
import { Subscribable, Subscriptions } from 'imng-ngrx-utils';
import { CompositeFilterDescriptor, FilterDescriptor } from '@progress/kendo-data-query';
import * as i2 from '@angular/common';

interface IKendoODataGridFacade<Entity> {
    loading$: Observable<boolean>;
    gridODataState$: Observable<ODataState | undefined>;
    gridData$: Observable<ODataResult<Entity> | undefined>;
    gridPagerSettings$: Observable<false | PagerSettings>;
    loadEntities(state: ODataState): void;
    reloadEntities(state?: ODataState): void;
}

declare abstract class KendoODataBasedComponent<ENTITY, FACADE extends IKendoODataGridFacade<ENTITY>> extends KendoGridBaseComponent<ENTITY> implements OnInit, OnDestroy, Subscribable {
    readonly facade: FACADE;
    readonly state: ODataState | Observable<ODataState>;
    readonly router: Router | null;
    readonly gridRefresh$: Observable<unknown> | null;
    /**
     * This sets the amount of the maximum amount of sortable columns for this component.  Default = 5.
     */
    maxSortedColumnCount: number;
    /**
     * This will allow you to provide a visual indicator that some of the columns have been hidden.
     */
    hasHiddenColumns$: Observable<boolean>;
    gridStateQueryKey: string;
    gridDataState: ODataState;
    gridDataResult$: Observable<ODataResult<ENTITY>>;
    loading$: Observable<boolean>;
    gridPagerSettings$: Observable<false | PagerSettings>;
    /**
     * A properties enum to make kendo grid columns definitions type safe
     * {@example <kendo-grid-column [field]="props.FIELD_NAME">}
     */
    abstract readonly props: any;
    protected expanders?: Expander[];
    protected transformations?: string;
    /**
     * The default filter descriptor is set by developer in the constructor initialization.
     * This is used to reset the filter when the "Clear Filter" button is clicked.
     *
     * @public
     * @type {CompositeFilterDescriptor | undefined}
     */
    defaultFilter: CompositeFilterDescriptor | undefined;
    constructor(facade: FACADE, state: ODataState | Observable<ODataState>, router?: Router | null, //NOSONAR
    gridRefresh$?: Observable<unknown> | null);
    ngOnInit(): void;
    deserializeODataState(stateQueryParam: string): ODataState;
    /**
     * This method ensures the proper handling of date filters in an OData query
     * @param filter
     */
    normalizeFilters(filter: FilterDescriptor | CompositeFilterDescriptor): void;
    serializeODataState(odataState: ODataState): string;
    /**
     * Will reset filters to initialGrid state passed into the constructor
     */
    resetFilters(): void;
    dataStateChange(state: GridStateChangeEvent | ODataState): void;
    excelData: () => Observable<ODataResult<ENTITY>>;
    loadEntities(odataState: ODataState): void;
    validateSortParameters(state: ODataState): ODataState;
    updateRouterState(state: ODataState): void;
    reloadEntities(): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<KendoODataBasedComponent<any, any>, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<KendoODataBasedComponent<any, any>, "ng-component", never, {}, {}, never, never, false, never>;
}

interface KendoODataGridState<Entity> {
    gridData: ODataResult<Entity>;
    loading: boolean;
    gridODataState: ODataState;
    /** Last known error (if any) */
    error: unknown | undefined;
    gridPagerSettings: PagerSettings | false;
}

declare const getODataPagerSettings: <T>(m: {
    gridData: ODataResult<T>;
    gridODataState?: ODataState;
}) => false | PagerSettings;
declare const mapPagerSettings: <T>() => (source: Observable<{
    gridData: ODataResult<T>;
    gridODataState?: ODataState;
}>) => Observable<false | PagerSettings>;

declare function createKendoODataGridInitialState<TEntity>(): KendoODataGridState<TEntity>;

declare class ImngODataGridDirective implements OnInit, AfterViewInit, OnDestroy, Subscribable {
    readonly gridComponent: GridComponent;
    readonly changeDetectorRef: ChangeDetectorRef;
    readonly allSubscriptions: Subscriptions;
    private facade;
    odataComponent: KendoODataBasedComponent<object, IKendoODataGridFacade<object>>;
    ngOnInit(): void;
    ngAfterViewInit(): void;
    ngOnDestroy(): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<ImngODataGridDirective, never>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<ImngODataGridDirective, "[imngODataGrid]", never, { "odataComponent": { "alias": "imngODataGrid"; "required": false; }; }, {}, never, never, false, never>;
}

declare class ImngKendoGridODataModule {
    static ɵfac: i0.ɵɵFactoryDeclaration<ImngKendoGridODataModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<ImngKendoGridODataModule, [typeof ImngODataGridDirective], [typeof i2.CommonModule, typeof i3.GridModule, typeof i3.PDFModule, typeof i3.ExcelModule, typeof i4.ImngKendoGridModule], [typeof ImngODataGridDirective]>;
    static ɵinj: i0.ɵɵInjectorDeclaration<ImngKendoGridODataModule>;
}

export { ImngKendoGridODataModule, ImngODataGridDirective, KendoODataBasedComponent, createKendoODataGridInitialState, getODataPagerSettings, mapPagerSettings };
export type { IKendoODataGridFacade, KendoODataGridState };
