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 { defineWidgetControls } from '@c8y/ngx-components/global-context';

const eventListWidgetControls = defineWidgetControls({
    name: 'event-list-widget',
    supports: ['timeRange', 'liveRefresh', 'displayMode', 'refreshInterval', 'refreshOption'],
    settings: {
        dashboard: {
            live: {
                inline: {
                    showAutoRefresh: true,
                    showTimeContext: true,
                    showRefreshInterval: true
                }
            },
            history: {
                inline: {
                    showTimeContext: true
                }
            }
        },
        config: {
            live: {
                inline: {
                    showAutoRefresh: true,
                    showTimeContext: false,
                    showAggregation: false
                },
                configuration: {
                    showTimeContext: true,
                    showAutoRefresh: true,
                    showAggregation: false
                }
            },
            history: {
                inline: {
                    showRefresh: true,
                    showTimeContext: false,
                    showAggregation: false
                },
                configuration: {
                    showAutoRefresh: false,
                    showRefreshInterval: false,
                    showTimeContext: true,
                    showAggregation: false
                }
            }
        },
        viewAndConfig: {
            live: {
                inline: {
                    showAutoRefresh: true,
                    showRefreshInterval: true,
                    showTimeContext: true,
                    showAggregation: false
                },
                configuration: {
                    showAutoRefresh: true,
                    showRefreshInterval: true,
                    showTimeContext: true,
                    showAggregation: false
                }
            },
            history: {
                inline: {
                    showTimeContext: true,
                    showAggregation: false
                },
                configuration: {
                    showTimeContext: true,
                    showAggregation: false
                }
            }
        },
        defaultLinks: {
            config: {},
            dashboard: {
                live: {
                    dateTimeContext: true,
                    isAutoRefreshEnabled: true
                },
                history: {
                    dateTimeContext: true
                }
            },
            viewAndConfig: {}
        }
    }
});

const eventListWidgetDefinition = {
    id: defaultWidgetIds.EVENT_LIST,
    label: gettext('Event list'),
    description: gettext('Displays a list of events filtered by object, type and date'),
    loadComponent: () => import('@c8y/ngx-components/widgets/implementations/events').then(m => m.EventListWidgetComponent),
    loadConfigComponent: () => import('@c8y/ngx-components/widgets/implementations/events').then(m => m.EventListWidgetConfigComponent),
    previewImage: 'c8y-style-assets/event-list-widget.png',
    resolve: {
        device: DynamicManagedObjectResolver
    },
    errorStrategy: DynamicComponentErrorStrategy.OVERLAY_ERROR,
    data: {
        schema: () => import('c8y-schema-loader?interfaceName=EventListWidgetConfig!@c8y/ngx-components/widgets/implementations/events'),
        export: exportConfigWithDevice,
        import: importConfigWithDevice,
        settings: {
            noNewWidgets: false,
            widgetDefaults: {
                _width: 8,
                _height: 4
            },
            ng1: {
                options: {
                    noDeviceTarget: false,
                    groupsSelectable: true,
                    deviceTargetNotRequired: true
                }
            }
        },
        displaySettings: {
            globalTimeContext: true,
            globalAutoRefreshContext: true
        }
    }
};
const eventListWidgetProviders = [
    hookWidget(eventListWidgetDefinition),
    hookWidgetConfig({
        widgetId: defaultWidgetIds.EVENT_LIST,
        priority: 10,
        label: gettext('Time context'),
        initialState: {
            widgetControls: eventListWidgetControls
        },
        loadComponent: () => import('@c8y/ngx-components/context-dashboard').then(m => m.GlobalContextSectionComponent)
    })
];

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

export { eventListWidgetDefinition, eventListWidgetProviders };
//# sourceMappingURL=c8y-ngx-components-widgets-definitions-event-list.mjs.map
