from django.urls import path, include
from rest_framework import routers

from dashboard import api

router = routers.DefaultRouter()
router.register('widgets/incs_by_cat', api.IncidentsByCategoryViewSet, basename='incidents_by_category')
router.register('widgets/assets_by_incs', api.AssetsByIncidentsViewSet, basename='assets_by_incs')
router.register('layout', api.DashboardLayoutViewSet, basename='layout_viewset')

urlpatterns = [
    path('widgets/sys_info/', api.SysInfoWidgetApi.as_view(), name='sys_info_widget'),
    path('widgets/sys_time/', api.SysTimeWidgetApi.as_view(), name='sys_time_widget'),
    path('widgets/incs_by_importance/', api.IncidentByImportanceApi.as_view(), name='incs_by_importance'),
    path('widgets/services_info/', api.ServicesWidgetApi.as_view(), name='services_info_widget'),
    path('widgets/opened_incs/', api.OpenedIncidentsWidgetApi.as_view(), name='opened_incs'),
    path('widgets/top_ids_events/', api.TopIdsEventsWidget.as_view(), name='top_ids_events'),
    path('redis/incs_by_time/data', api.get_current_incidents_by_time_widget_data, name='incs_by_time_redis_data'),
    path('redis/events_by_time/data', api.get_current_events_by_time_widget_data, name='events_by_time_redis_data'),
    path('widgets/correlator', api.CorrelatorStat.as_view(), name='correlator_stat'),
    path('', include(router.urls)),
    path('add_new_widget_form', api.add_widget_form, name='api_add_widget_to_layout')
]
