import { gettext } from '@c8y/ngx-components/gettext';
import { DynamicComponentErrorStrategy, DynamicManagedObjectResolver, hookWidget } from '@c8y/ngx-components';
import { hookWidgetConfig } from '@c8y/ngx-components/context-dashboard';
import { defaultWidgetIds } from '@c8y/ngx-components/widgets/definitions';
import { importConfigWithDevice, exportConfigWithDevice } from '@c8y/ngx-components/widgets/import-export-config';
import { createLegacyAlarmControls } from '@c8y/ngx-components/widgets/definitions/alarms/alarm-widget-controls.presets';

const RECENT_ALARM_CONTROLS = createLegacyAlarmControls();
const recentAlarmsDefinition = {
    id: defaultWidgetIds.RECENT_ALARMS,
    label: gettext('Recent alarms'),
    description: gettext('Log of recent alarms from all devices with any severity and status'),
    loadComponent: () => import('@c8y/ngx-components/widgets/implementations/alarms').then(m => m.AlarmListWidgetComponent),
    loadConfigComponent: () => import('@c8y/ngx-components/widgets/implementations/alarms').then(m => m.AlarmListWidgetConfigComponent),
    resolve: {
        device: DynamicManagedObjectResolver
    },
    errorStrategy: DynamicComponentErrorStrategy.OVERLAY_ERROR,
    data: {
        schema: () => import('c8y-schema-loader?interfaceName=AlarmListWidgetConfig!@c8y/ngx-components/widgets/implementations/alarms'),
        export: exportConfigWithDevice,
        import: importConfigWithDevice,
        widgetControls: RECENT_ALARM_CONTROLS,
        settings: {
            recentAlarmsWidget: true,
            noNewWidgets: true,
            widgetDefaults: {
                _width: 4,
                _height: 4
            },
            ng1: {
                options: {
                    noDeviceTarget: false,
                    groupsSelectable: true,
                    deviceTargetNotRequired: true
                }
            }
        },
        displaySettings: {
            globalAutoRefreshContext: true
        }
    }
};
const recentAlarmsWidgetProviders = [
    hookWidget(recentAlarmsDefinition),
    hookWidgetConfig({
        widgetId: defaultWidgetIds.RECENT_ALARMS,
        priority: 10,
        label: gettext('Time context'),
        initialState: {
            widgetControls: RECENT_ALARM_CONTROLS
        },
        loadComponent: () => import('@c8y/ngx-components/context-dashboard').then(m => m.GlobalContextSectionComponent)
    })
];

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

export { recentAlarmsDefinition, recentAlarmsWidgetProviders };
//# sourceMappingURL=c8y-ngx-components-widgets-definitions-alarms-recent-alarms.mjs.map
