import { gettext } from '@c8y/ngx-components/gettext';
import { DynamicComponentErrorStrategy, DynamicDatapointsResolver, hookWidget } from '@c8y/ngx-components';
import { hookWidgetConfig } from '@c8y/ngx-components/context-dashboard';
import { defaultWidgetIds } from '@c8y/ngx-components/widgets/definitions';
import { importConfigWithTargets, exportConfigWithTargets } from '@c8y/ngx-components/widgets/import-export-config';
import { PRESET_NAME } from '@c8y/ngx-components/global-context';

const DATAPOINT_SELECT_DEFAULT_OPTIONS = {
    selectableChartLineTypes: [],
    selectableAxisTypes: [],
    showRedRange: true,
    showYellowRange: true
};
const MIN_ACTIVE_COUNT = 1;

const dataPointsTableWidgetDefinition = {
    id: defaultWidgetIds.DATA_POINTS_TABLE,
    label: gettext('Data points table'),
    description: gettext(`A table display of a collection of data points`),
    loadComponent: () => import('@c8y/ngx-components/widgets/implementations/datapoints-table').then(m => m.DatapointsTableViewWidgetComponent),
    loadConfigComponent: () => import('@c8y/ngx-components/widgets/implementations/datapoints-table').then(m => m.DatapointsTableWidgetConfigComponent),
    previewImage: 'c8y-style-assets/data-points-table-widget.png',
    resolve: {
        datapoints: DynamicDatapointsResolver
    },
    errorStrategy: DynamicComponentErrorStrategy.OVERLAY_ERROR,
    data: {
        schema: () => import('c8y-schema-loader?interfaceName=DatapointsTableConfig&type=widget-config!@c8y/ngx-components/widgets/implementations/datapoints-table'),
        export: exportConfigWithTargets,
        import: importConfigWithTargets,
        controls: PRESET_NAME.DATA_TABLE_CONFIG,
        settings: {
            noNewWidgets: false,
            widgetDefaults: {
                _width: 8,
                _height: 4
            },
            ng1: {
                options: {
                    noDeviceTarget: true,
                    minCol: 6,
                    datapointAttributes: ['datapoints']
                }
            }
        },
        displaySettings: {
            globalAutoRefreshContext: true,
            globalTimeContext: true,
            globalRealtimeContext: false,
            globalAggregationContext: true
        }
    }
};
const dataPointsTableWidgetProviders = [
    hookWidget(dataPointsTableWidgetDefinition),
    hookWidgetConfig({
        widgetId: defaultWidgetIds.DATA_POINTS_TABLE,
        priority: 10,
        label: gettext('Time context'),
        initialState: {
            controls: PRESET_NAME.DATA_TABLE_CONFIG
        },
        loadComponent: () => import('@c8y/ngx-components/context-dashboard').then(m => m.GlobalContextSectionComponent)
    }),
    hookWidgetConfig({
        widgetId: defaultWidgetIds.DATA_POINTS_TABLE,
        label: gettext('Data point selection'),
        loadComponent: () => import('@c8y/ngx-components/datapoint-selector').then(m => m.WidgetDatapointsSelectorComponent),
        initialState: {
            minActiveCount: MIN_ACTIVE_COUNT,
            defaultFormOptions: DATAPOINT_SELECT_DEFAULT_OPTIONS
        },
        expanded: true,
        priority: 100
    })
];

/**
 * Generated bundle index. Do not edit.
 */

export { dataPointsTableWidgetDefinition, dataPointsTableWidgetProviders };
//# sourceMappingURL=c8y-ngx-components-widgets-definitions-datapoints-table.mjs.map
