from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
from django.utils.translation import gettext_lazy as _

from aircox.urls import urls
import aircox_streamer.urls

from radiocampus.views import HomeTimeTableView, TimeTableView
from aircox.views.dashboard import DashboardView

urlpatterns = [
    path("streamer/", include((aircox_streamer.urls.urls, "aircox_streamer"), namespace="streamer")),
    path("admin/", admin.site.urls),
    path("accounts/", include("django.contrib.auth.urls")),
    path("filer/", include("filer.urls")),
    path("gestion/", DashboardView.as_view(), name="dashboard"),
]

for url in urls:
    if "name" in url.__dict__.keys():
        if url.name == "home" or url.name == "timetable-list":
            continue
    urlpatterns.append(url)


urlpatterns.append(path("", HomeTimeTableView.as_view(), name="home"))

urlpatterns.extend(
    [
        path(_("timetable/"), TimeTableView.as_view(), name="timetable-list"),
        path(
            _("timetable/<date:date>/"),
            TimeTableView.as_view(),
            name="timetable-list",
        ),
    ]
)

if settings.DEBUG:
    from debug_toolbar.toolbar import debug_toolbar_urls

    urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) + static(
        settings.MEDIA_URL, document_root=settings.MEDIA_ROOT
    )
    urlpatterns += debug_toolbar_urls()
