import * as i0 from '@angular/core';
import { OnInit, OnDestroy, TemplateRef } from '@angular/core';
import { ValidatorFn, FormBuilder, NgForm } from '@angular/forms';
import { OnBeforeSave, MeasurementRealtimeService } from '@c8y/ngx-components';
import { WidgetConfigComponent, WidgetConfigService, ContextDashboardComponent } from '@c8y/ngx-components/context-dashboard';
import { KPIDetails, DatapointSelectorModalOptions, DatapointAttributesFormConfig } from '@c8y/ngx-components/datapoint-selector';
import { Observable } from 'rxjs';
import { SupportedIconsSuggestions } from '@c8y/ngx-components/icon-selector/icons';

interface KpiWidgetConfig {
    datapoints: KPIDetails[];
    icon?: SupportedIconsSuggestions | null;
    showTimestamp?: boolean | null;
    showTrend?: boolean | null;
    showIcon?: boolean | null;
    numberOfDecimalPlaces?: number | null;
    fontSize?: number | null;
}

declare function exactlyASingleDatapointActive(): ValidatorFn;
declare class KpiWidgetConfigComponent implements OnInit, OnDestroy, OnBeforeSave {
    private formBuilder;
    private form;
    private widgetConfig;
    private widgetConfigService;
    set previewMapSet(template: TemplateRef<unknown>);
    config: KpiWidgetConfig;
    previewActiveDatapoint: KPIDetails;
    datapointSelectionConfig: Partial<DatapointSelectorModalOptions>;
    defaultFormOptions: Partial<DatapointAttributesFormConfig>;
    formGroup: ReturnType<KpiWidgetConfigComponent['createForm']>;
    availableIcons: string[];
    previewConfig: KpiWidgetConfig;
    private destroy$;
    private limits;
    constructor(formBuilder: FormBuilder, form: NgForm, widgetConfig: WidgetConfigComponent, widgetConfigService: WidgetConfigService);
    onBeforeSave(config?: KpiWidgetConfig): boolean | Promise<boolean> | Observable<boolean>;
    ngOnInit(): Promise<void>;
    ngOnDestroy(): void;
    private applyLimits;
    private initForm;
    private createPreviewLimitedValue;
    private createForm;
    static ɵfac: i0.ɵɵFactoryDeclaration<KpiWidgetConfigComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<KpiWidgetConfigComponent, "c8y-kpi-widget-config", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
}

interface MeasurementValue {
    unit?: string;
    value: number;
    date: string;
}
declare enum ColorClass {
    danger = "text-danger",
    warning = "text-warning",
    unknown = ""
}
declare class KpiWidgetViewComponent implements OnInit {
    private measurementRealtime;
    private dashboard;
    config: KpiWidgetConfig;
    state$: Observable<{
        latestMeasurement: MeasurementValue;
        previousValue: MeasurementValue | undefined;
        trend: string;
        unit: string;
        colorClass: ColorClass;
    }>;
    noDataInitiallyInDB: boolean;
    constructor(measurementRealtime: MeasurementRealtimeService, dashboard: ContextDashboardComponent);
    ngOnInit(): Promise<void>;
    setupObservable(datapoint: KPIDetails): Observable<{
        latestMeasurement: MeasurementValue;
        previousValue: MeasurementValue | undefined;
        trend: string;
        unit: string;
        colorClass: ColorClass;
    }>;
    private getLatestMeasurement$;
    private getColorClass$;
    private getLastTwoValuesOfObservable$;
    private getTrendOfLatestMeasurements$;
    private inRangeOf;
    private assignContextFromContextDashboard;
    static ɵfac: i0.ɵɵFactoryDeclaration<KpiWidgetViewComponent, [null, { optional: true; }]>;
    static ɵcmp: i0.ɵɵComponentDeclaration<KpiWidgetViewComponent, "c8y-kpi-widget-view", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
}

export { KpiWidgetConfigComponent, KpiWidgetViewComponent, exactlyASingleDatapointActive };
export type { KpiWidgetConfig };
//# sourceMappingURL=index.d.ts.map
