import { AfterViewInit, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
import { AlarmService, IAlarm, IResultList } from '@c8y/client';
import { AlarmRealtimeService, AlarmWithChildrenRealtimeService, AlertService, DashboardChildComponent, DynamicComponent, DynamicComponentAlertAggregator, WidgetGlobalAutoRefreshService } from '@c8y/ngx-components';
import { AlarmsViewService } from '@c8y/ngx-components/alarms';
import { BehaviorSubject } from 'rxjs';
import { AlarmListWidgetConfig } from '../alarm-list-widget.model';
import { AlarmWidgetService } from '../alarm-widget.service';
import { AlarmWidgetAlarmsReloadComponent } from '../alarm-widget-alarms-reload.component';
import { Interval } from '@c8y/ngx-components/interval-picker';
import * as i0 from "@angular/core";
/**
 * To ensure backward compatibility, legacy widgets will be converted to the new implementation.
 */
export declare class AlarmListWidgetComponent implements OnInit, AfterViewInit, OnDestroy, DynamicComponent {
    private alarmWidgetService;
    private alarmRealtimeService;
    private alarmService;
    private alarmsViewService;
    private alarmWithChildrenRealtimeService;
    private dashboardChild;
    private alertService;
    private widgetGlobalAutoRefresh;
    /**
     *  Alarm widget config.
     */
    config: AlarmListWidgetConfig;
    /**
     * Represents current alarms.
     */
    alarms$: BehaviorSubject<IResultList<IAlarm> | null>;
    /**
     * Current isLoading state. Based on it next countdown cycle is being started.
     */
    isLoading$: BehaviorSubject<boolean>;
    /**
     * State of this boolean depends on an Application Options "alarmsRefreshType" setting.
     */
    isIntervalRefresh: boolean;
    /**
     * Current refresh interval set in a widget config.
     */
    refreshInterval: number;
    alarmWidgetAlarmsReloadComp: AlarmWidgetAlarmsReloadComponent;
    alerts: DynamicComponentAlertAggregator;
    private TIMEOUT_ERROR_TEXT;
    private SERVER_ERROR_TEXT;
    private unsubscribe$;
    private destroy$;
    isDisabled: boolean;
    constructor(alarmWidgetService: AlarmWidgetService, alarmRealtimeService: AlarmRealtimeService, alarmService: AlarmService, alarmsViewService: AlarmsViewService, alarmWithChildrenRealtimeService: AlarmWithChildrenRealtimeService, dashboardChild: DashboardChildComponent, alertService: AlertService, widgetGlobalAutoRefresh: WidgetGlobalAutoRefreshService);
    ngOnInit(): Promise<void>;
    ngAfterViewInit(): void;
    ngOnChanges(changes: SimpleChanges): void;
    ngOnDestroy(): void;
    fetchAlarms(): Promise<void>;
    onDateFilterChange(event: {
        selectedDates: [Date, Date];
        interval: Interval['id'];
    }): Promise<void>;
    handleRealTimeToggleChange(isRealtimeToggleOn: boolean): void;
    /**
     * Updates the widget's date filter based on the currently selected interval.
     * If the interval is set to last hour, we will configure the date filter to dynamically show alarms only from the last hour.
     */
    private updateDateFilter;
    /**
     * Updates the widget's refresh mode based on the current configuration and the interval refresh setting.
     * If the widget's 'isRealtime' configuration differs from the current global interval refresh setting (application options setting),
     * the widget's mode is updated to either 'realtime' or 'interval'. In 'realtime' mode, the refresh interval is null,
     * and in 'interval' mode, it is set to the default interval value.
     */
    private updateWidgetRefreshMode;
    private getAlarms;
    /**
     * Handles the realtime updates of alarms based on the widget configuration.
     * If a specific device is provided in the widget configuration, all alarms
     * originating from that device and its children are filtered based on status, severity, and type.
     * Otherwise, it processes all incoming alarms and filters them according to status, severity, and type,
     * as specified in the widget configuration. If new alarms meet the specified criteria, it sets a flag
     * to indicate the presence of new alarms.
     *
     * @param config - The configuration settings of the alarm list widget.
     * @param isRealtimeToggleOn - A flag indicating whether the realtime toggle is on. If true, the alarm list will be refreshed.
     * If false, the presence of new alarms will be displayed as "New Alarms" entry on widget refresh button, but the list won't be refreshed automatically.
     */
    private handleRealtimeAlarms;
    /**
     * Sets up a subscription to a realtime data stream. This function takes a subscriber function,
     * which is used to subscribe to the data stream, and a callback function, which is called with each
     * data update received from the stream.
     *
     * @param subscriberFn - A function that returns an observable stream of alarm data.
     * @param callback - A function to be executed with each alarm data update.
     */
    private handleRealtime;
    private setLegacyRecentOrCriticalAlarmWidgetConfig;
    private handleGlobalRefreshLoading;
    static ɵfac: i0.ɵɵFactoryDeclaration<AlarmListWidgetComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<AlarmListWidgetComponent, "c8y-alarm-list-widget", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, false, never>;
}
//# sourceMappingURL=alarm-list-widget.component.d.ts.map