"""
All urls configurations tree
"""

from django.conf import settings
from django.contrib import admin
from django.http import HttpResponse
from django.urls import include, path, re_path
from django.views.static import serve

from routes.swagger import schema_view


def health(request):
    return HttpResponse("OK: #e300e79ae3e5dbce142672f917cc1ff664810d8c")


urlpatterns = [
    path("health/", health),
    path("admin/", admin.site.urls),
    path("rosetta/", include("rosetta.urls")),
    path("accounts/", include("django.contrib.auth.urls")),
    path(
        "ckeditor5/",
        include("django_ckeditor_5.urls"),
        name="ck_editor_5_upload_file",
    ),  # noqa
    path("i18n/", include("django.conf.urls.i18n")),
    # Internal apps
    path("api/", include("core.apps.accounts.urls")),
    path("", include("core.apps.home.urls")),
    path("api/", include("core.apps.eggs.urls")),
    # Media and static files
    re_path(
        r"static/(?P<path>.*)", serve, {"document_root": settings.STATIC_ROOT}
    ),  # noqa
    re_path(
        r"media/(?P<path>.*)", serve, {"document_root": settings.MEDIA_ROOT}
    ),  # noqa
    # Swagger urls
    path(
        "swagger<format>/",
        schema_view.without_ui(cache_timeout=120),
        name="schema-json",
    ),  # noqa
    path(
        "swagger/",
        schema_view.with_ui("swagger", cache_timeout=120),
        name="schema-swagger-ui",
    ),  # noqa
    path(
        "redoc/",
        schema_view.with_ui("redoc", cache_timeout=120),
        name="schema-redoc",
    ),  # noqa
]
