import * as i0 from '@angular/core';
import { OnInit, OnDestroy, TemplateRef, OnChanges, ElementRef, SimpleChanges } from '@angular/core';
import { KPIDetails } from '@c8y/ngx-components/datapoint-selector';
import { Observable } from 'rxjs';
import { ECharts } from 'echarts/core';
import { DynamicComponent, DynamicComponentAlertAggregator } from '@c8y/ngx-components';
import { EChartsOption } from 'echarts';

/**
 * Configuration interface for the Pie Chart widget.
 * Stored in the widget's config property on the dashboard.
 */
interface PieChartConfig {
    /** Display options for the pie chart */
    pieChartOptions: PieChartOptions;
    /** Array of datapoints to display in the chart */
    datapoints: KPIDetails[];
}
/**
 * Display options for the Pie Chart widget.
 */
interface PieChartOptions {
    /** Show percentage labels inside pie slices */
    showLabels: boolean;
    /** Show legend with datapoint names */
    showLegend: boolean;
    /** Show tooltips on hover with value and unit */
    showTooltips: boolean;
}

declare class PieChartWidgetConfigComponent implements OnInit, OnDestroy {
    config: PieChartConfig;
    formGroup: ReturnType<PieChartWidgetConfigComponent['initForm']>;
    private readonly destroy$;
    set previewMapSet(template: TemplateRef<any>);
    private readonly widgetConfigService;
    private readonly formBuilder;
    ngOnInit(): void;
    ngOnDestroy(): void;
    onBeforeSave(config?: PieChartConfig): boolean | Promise<boolean> | Observable<boolean>;
    private initForm;
    static ɵfac: i0.ɵɵFactoryDeclaration<PieChartWidgetConfigComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<PieChartWidgetConfigComponent, "app-pie-chart-config", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
}

declare class PieChartWidgetViewComponent implements OnChanges, DynamicComponent {
    config: PieChartConfig;
    chart: ElementRef;
    activeDatapoints: KPIDetails[];
    chartOptions$: Observable<EChartsOption>;
    alerts: DynamicComponentAlertAggregator;
    echartsInstance: ECharts;
    private readonly configChanged$;
    private readonly measurements;
    private readonly translateService;
    constructor();
    ngOnChanges(_: SimpleChanges): void;
    onChartInit(ec: ECharts): void;
    /**
     * Fetches latest measurements for all configured datapoints.
     */
    private fetchMeasurements;
    /**
     * Maps a datapoint and its measurement to a DatapointValue.
     */
    private mapToDatapointValue;
    /**
     * Handles negative value alerts - clears existing alerts and adds warning if needed.
     */
    private handleNegativeValues;
    /**
     * Builds the ECharts options based on datapoint values.
     */
    private buildChartOptions;
    /**
     * Checks if chart should display empty state (no positive data).
     */
    private isEmptyState;
    /**
     * Builds options for empty state display.
     */
    private buildEmptyStateOptions;
    /**
     * Builds the pie chart options with data.
     */
    private buildPieChartOptions;
    /**
     * Calculates total of all entry values.
     */
    private calculateTotal;
    /**
     * Builds tooltip configuration.
     */
    private buildTooltipConfig;
    /**
     * Builds legend configuration.
     */
    private buildLegendConfig;
    /**
     * Builds pie series configuration.
     */
    private buildPieSeriesConfig;
    /**
     * Formats percentage label for pie slice.
     */
    private formatPercentageLabel;
    /**
     * Updates the ECharts instance with new options.
     */
    private updateChartInstance;
    /**
     * Encodes HTML to prevent XSS attacks.
     */
    private encodeHtml;
    static ɵfac: i0.ɵɵFactoryDeclaration<PieChartWidgetViewComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<PieChartWidgetViewComponent, "c8y-pie-chart", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
}

export { PieChartWidgetConfigComponent, PieChartWidgetViewComponent };
//# sourceMappingURL=index.d.ts.map
