import * as i0 from '@angular/core';
import { OnInit, OnDestroy, TemplateRef, EventEmitter } from '@angular/core';
import { IIdentified, QueriesUtil, IManagedObject } from '@c8y/client';
import { ColumnConfig, IconConfigItem, ComputedConfig, AssetColumnOperationType, CustomColumn, CustomColumnType, DisplayOptions, WidgetDisplaySettings, BaseColumn, WidgetSettings, AssetTableExtendedColumn, ServerSideDataCallback, DataSourceModifier, ServerSideDataResult, GridConfig, Column, Pagination } from '@c8y/ngx-components';
import { BehaviorSubject } from 'rxjs';
import { KPIDetails } from '@c8y/ngx-components/datapoint-selector';
import { AssetPropertyType } from '@c8y/ngx-components/asset-properties';
import { CdkDragDrop } from '@angular/cdk/drag-drop';
import { BsDropdownDirective } from 'ngx-bootstrap/dropdown';

declare class DefaultAssetTableGridColumn extends CustomColumnExtended {
    constructor(initialColumnConfig?: CustomColumnConfigExtended);
}

declare class OperationAssetTableGridColumn extends BaseColumnExtended {
    constructor(initialColumnConfig?: ColumnConfigExtended);
}

interface AssetTableWidgetConfig {
    columnSortOrders?: Record<string, 'asc' | 'desc' | ''>;
    columns?: DefaultAssetTableGridColumn[];
    configurableColumnsEnabled?: boolean;
    device?: IIdentified;
    displayOptions?: Partial<ExtendedDisplayOptions>;
    displaySettings?: WidgetDisplaySettings;
    filterPredicate?: Record<string, any>;
    isAutoRefreshEnabled?: boolean;
    operationColumns?: OperationAssetTableGridColumn[];
    refreshInterval?: number;
    options?: LegacyAssetTableWidgetOptions;
    refreshOption?: AssetTableRefreshOption;
    includeDescendants?: boolean;
    selectedProperties?: AssetPropertyType[];
    showAsLink?: boolean;
    showStatusIcon?: boolean;
    showIconAndValue?: boolean;
    settings?: WidgetSettings;
    title?: string;
    columnOrder?: AssetTableExtendedColumn[];
    isDeviceAssetSelected?: boolean;
    widgetInstanceGlobalAutoRefreshContext?: boolean;
    widgetInstanceGlobalTimeContext?: boolean;
}
interface LegacyAssetTableWidgetOptions {
    properties: {
        active: boolean;
        id: string;
        name: string;
        label: string;
        type: string;
        visible: boolean;
        keyPath: string | string[];
        isAction?: boolean;
        instanceId?: string;
        computed?: boolean;
        config?: {
            dp?: KPIDetails[];
            resultType?: number;
            __propertyName?: string;
            _id?: string;
        };
        iconConfig: {
            color?: string;
            comparison: ComparisonOption;
            dataType?: {
                label: string;
                value: string;
            };
            icon?: string;
            value: string | number | boolean;
        }[];
        columnType?: AssetColumnType;
        renderType?: string;
        renderConfig?: {
            actionType?: 'createOperation' | 'toggleMaintenanceMode';
            args?: [
                {
                    [key: string]: any;
                }
            ];
            deviceTypes?: string[];
            label: string;
            map?: {
                label: string;
                value: string;
                comparison: string;
                color?: string;
                dataType?: {
                    label: string;
                    value: string;
                };
                icon?: string;
            }[];
        };
        __active?: boolean;
        c8y_JsonSchema?: {
            [key: string]: {
                label?: string;
                type?: string;
            };
        };
    }[];
}
type AssetTableRefreshOption = 'interval' | 'global-interval';
interface ComparisonOption {
    label: string;
    value: string;
    sign: string;
}
interface ExtendedDisplayOptions extends DisplayOptions {
    configurableColumnsEnabled?: boolean;
}
type AssetColumnType = 'alarm' | 'date' | 'icon' | 'computed' | 'default' | 'operation';
declare class BaseColumnExtended extends BaseColumn {
    iconConfig?: Array<IconConfigItem>;
    isLink?: boolean;
    command?: object;
    isOperation?: boolean;
    operationType?: AssetColumnOperationType;
    computedConfig?: ComputedConfig;
    showIconAndValue?: boolean;
    buttonLabel?: string;
    type?: AssetColumnType;
}
declare class CustomColumnExtended extends CustomColumn {
    iconConfig?: Array<IconConfigItem>;
    isLink?: boolean;
    command?: object;
    isOperation?: boolean;
    operationType?: AssetColumnOperationType;
    computedConfig?: ComputedConfig;
    showIconAndValue?: boolean;
    columnOrder?: [];
}
interface ColumnConfigExtended extends ColumnConfig {
    /** Column header title */
    header?: string;
    /** The path in a row item to read the cell value from. */
    path?: string;
    /**
     * Icon configuration for the column when renderType is 'icon'.
     */
    iconConfig?: Array<IconConfigItem>;
    /** Configuration for computed column */
    computedConfig?: ComputedConfig;
    /** Whether the column is a link. */
    isLink?: boolean;
    /** The column operationType. E.g. 'maintenance' */
    operationType?: AssetColumnOperationType;
    /** Command to be executed */
    command?: any;
    /** Whether to show both icon and value in the cell */
    showIconAndValue?: boolean;
    /** Button label for operation columns */
    buttonLabel?: string;
    /** e.g. 'Restart Device', 'Firmware Update', 'Send Command' */
    operation?: string;
}
interface CustomColumnConfigExtended extends ColumnConfigExtended {
    /** JSON path to the managed object property to be displayed */
    path: string;
    /** Column header title */
    header: string;
    /** Flag to identify custom columns */
    custom: boolean;
    /** Column type of the custom column*/
    type: CustomColumnType;
}

declare class AssetTableWidgetConfigComponent implements OnInit, OnDestroy {
    set previewMapSet(template: TemplateRef<any>);
    readonly GLOBAL_INTERVAL_OPTION: AssetTableRefreshOption;
    readonly REFRESH_INTERVAL_IN_MILLISECONDS: number[];
    title: "Asset table";
    columns: AssetTableExtendedColumn[];
    selectedAssets: AssetPropertyType[];
    serverSideDataCallback: ServerSideDataCallback;
    refresh: EventEmitter<void>;
    formGroup: ReturnType<AssetTableWidgetConfigComponent['createForm']>;
    /**
     * Current isLoading state. Based on it next countdown cycle is being started.
     */
    isLoading$: BehaviorSubject<boolean>;
    refreshOption: AssetTableRefreshOption;
    config: AssetTableWidgetConfig;
    includeDescendantsTooltip: "When enabled, all assets in the hierarchy under the selected asset will be included. When disabled, only the direct child assets will be included.";
    private initializedContext;
    private migrationApplied;
    protected queriesUtil: QueriesUtil;
    private destroy$;
    private readonly formBuilder;
    private readonly assetTableService;
    private readonly widgetGlobalAutoRefresh;
    private readonly alertService;
    private readonly widgetConfigService;
    private readonly contextDashboardService;
    constructor();
    ngOnInit(): void;
    ngOnDestroy(): void;
    /**
     * This method loads data when data grid requests it (e.g. on initial load or on column settings change).
     * It gets the object with current data grid setup and is supposed to return:
     * full response, list of items, paging object, the number of items in the filtered subset, the number of all items.
     */
    onDataSourceModifier(dataSourceModifier: DataSourceModifier): Promise<ServerSideDataResult>;
    onGridSort(config: GridConfig): void;
    updateSelectedAssets(): Promise<void>;
    updateRefreshOption(): void;
    private getColumns;
    private handleGlobalRefreshLoading;
    private updateConfigBasedOnRefreshOption;
    private updateFormDisabledState;
    private setupGridHeaderFilterDependency;
    private applyGridHeaderDependentState;
    private initializeForm;
    private createForm;
    static ɵfac: i0.ɵɵFactoryDeclaration<AssetTableWidgetConfigComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<AssetTableWidgetConfigComponent, "c8y-asset-table-widget-config", never, {}, {}, never, never, true, never>;
}

declare class AssetTableWidgetViewComponent implements OnInit, OnDestroy {
    config: AssetTableWidgetConfig;
    /**
     * Current isLoading state. Based on it next countdown cycle is being started.
     */
    isLoading$: BehaviorSubject<boolean>;
    selectedAssets: any[];
    columns: Column[];
    refresh: EventEmitter<any>;
    serverSideDataCallback: ServerSideDataCallback;
    pagination: Pagination;
    private destroy$;
    private readonly widgetGlobalAutoRefresh;
    private readonly assetTableService;
    private readonly alertService;
    constructor();
    ngOnInit(): Promise<void>;
    ngOnDestroy(): void;
    /**
     * This method loads data when data grid requests it (e.g. on initial load or on column settings change).
     * It gets the object with current data grid setup and is supposed to return:
     * full response, list of items, paging object, the number of items in the filtered subset, the number of all items.
     */
    onDataSourceModifier(dataSourceModifier: DataSourceModifier): Promise<ServerSideDataResult>;
    onGridSort(config: GridConfig): void;
    updateSelectedAssets(): void;
    private handleGlobalRefreshLoading;
    static ɵfac: i0.ɵɵFactoryDeclaration<AssetTableWidgetViewComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<AssetTableWidgetViewComponent, "c8y-asset-table-widget-view", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
}

declare class AssetTableGridSettingsComponent implements OnInit, OnDestroy {
    contextAsset: IManagedObject;
    columns: AssetTableExtendedColumn[];
    selectedProperties: AssetPropertyType[];
    extraProperties: AssetPropertyType[];
    operationColumns: ColumnConfigExtended[];
    text: string;
    existingColumnFilter: {
        [key: string]: any;
    };
    hasMaintenanceColumn: boolean;
    customHeaderNames: Record<string, string>;
    customLabel: "(custom`column`)";
    private readonly widgetConfigService;
    private readonly assetTableService;
    private readonly bottomDrawerService;
    private readonly inventoryService;
    private readonly modalService;
    private readonly operationPickerService;
    private readonly destroy$;
    ngOnInit(): void;
    ngOnDestroy(): void;
    applyColumnType(type: AssetColumnType, column: AssetTableExtendedColumn): Promise<void>;
    onColumnDrop(event: CdkDragDrop<AssetTableExtendedColumn[]>): void;
    toggleColumnVisibility(column: AssetTableExtendedColumn): void;
    applyFilter(column: AssetTableExtendedColumn, dropdown: BsDropdownDirective): void;
    resetFilter(column: AssetTableExtendedColumn, dropdown: BsDropdownDirective): void;
    isColumnFiltered(column: AssetTableExtendedColumn): boolean;
    updateColumnNames(column: AssetTableExtendedColumn): void;
    changeSortOrder(column: AssetTableExtendedColumn): void;
    onCreateOperation(): Promise<void>;
    onToggleMaintenanceMode(): Promise<void>;
    editOperationColumn(column: AssetTableExtendedColumn): Promise<void>;
    deleteColumn(column: AssetTableExtendedColumn): void;
    trackByColumnName(_index: number, column: AssetTableExtendedColumn): string;
    selectAssetAndProperty(): Promise<void>;
    selectProperties(selectedProperties: AssetPropertyType[]): void;
    private applyCustomHeaderNames;
    private operationModal;
    private getColumns;
    static ɵfac: i0.ɵɵFactoryDeclaration<AssetTableGridSettingsComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<AssetTableGridSettingsComponent, "c8y-asset-table-column-settings", never, {}, {}, never, never, true, never>;
}

export { AssetTableGridSettingsComponent, AssetTableWidgetConfigComponent, AssetTableWidgetViewComponent };
//# sourceMappingURL=index.d.ts.map
