from django.urls import include, path

from apps.core import views
from apps.core import views_access
from apps.core.notifications import admin_views as notif_admin_views

app_name = "core"

urlpatterns = [
    path("dashboard/", views.dashboard_home, name="dashboard"),
    path("moodle/course-thumb/<int:course_id>/", views.moodle_course_thumbnail, name="moodle_course_thumbnail"),
    path("exports/", include("apps.core.exports.urls")),
    path("access/users/", views_access.user_list_view, name="user_manage_list"),
    path("access/users/new/", views_access.user_create_view, name="user_manage_create"),
    path("access/users/<int:pk>/", views_access.user_edit_view, name="user_manage_edit"),
    path(
        "access/users/<int:pk>/resync-groups/",
        views_access.user_resync_groups_view,
        name="user_manage_resync_groups",
    ),
    path("access/roles/", views_access.role_list_view, name="role_permissions_list"),
    path("access/roles/new/", views_access.role_create_view, name="role_create"),
    path(
        "access/roles/<int:group_id>/permissions/",
        views_access.role_permissions_view,
        name="role_permissions_edit",
    ),
    path("access/permissions/new/", views_access.permission_create_view, name="permission_create"),
    path("audit/logs/", views.audit_log_list, name="audit_log_list"),
    path("notifications/", views.notification_inbox, name="notification_inbox"),
    path(
        "notifications/mark-all-read/",
        views.notification_mark_all_read,
        name="notification_mark_all_read",
    ),
    path(
        "notifications/<int:pk>/read/",
        views.notification_mark_read,
        name="notification_mark_read",
    ),
    path(
        "notifications/<int:pk>/go/",
        views.notification_go,
        name="notification_go",
    ),
    path(
        "notifications/badge/",
        views.notification_badge_partial,
        name="notification_badge",
    ),
    path("search/", views.global_search, name="global_search"),
    path(
        "notifications/stream/",
        views.notification_stream,
        name="notification_stream",
    ),
    # WS5.13 — staff editor for NotificationTemplate rows.
    path(
        "manage/notification-templates/",
        notif_admin_views.NotificationTemplateListView.as_view(),
        name="notification_template_list",
    ),
    path(
        "manage/notification-templates/<str:verb>/",
        notif_admin_views.NotificationTemplateEditView.as_view(),
        name="notification_template_edit",
    ),
]
