# Path: apps/core/views/general.py
# def _get_document(category, version=''):
# def main(request):
# def lang(request, code):
# def credits(request):
# def terms(request, version=''):
# def privacy(request, version=''):
# def stats(request):
# def help(request):
# def contact(request):
# def csrf_failure(request, reason=''):


from django.conf import settings, urls
from django.conf.urls.static import static
from django.contrib import admin
from django.shortcuts import render
from django.urls import include, path, re_path
from apps.core.views import general
    path('lang/<str:code>/', general.lang),

    re_path(r'^terms/(?P<version>[\d\.]+)?$', general.terms),
    re_path(r'^privacy/(?P<version>[\d\.]+)?$', general.privacy),

    path('credits/', general.credits),
    path('stats/', general.stats),
    path('help/', general.help),
    path('contact/', general.contact),

    path('account/', include('apps.core.urls')),
    path('api/', include('apps.api.urls')),
    path('dev/', include('apps.dev.urls')),
    path('web-api/', include('apps.web.urls')),

    path('manage/', admin.site.urls),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)


def build_handler(status: int):
    def handler(request, exception=None):
        return render(request, f'error/{status}.html', status=status)
    return handler


urls.handler400 = build_handler(400)

# Path: apps/core/views/general.py
# def _get_document(category, version=''):
# def main(request):
# def lang(request, code):
# def credits(request):
# def terms(request, version=''):
# def privacy(request, version=''):
# def stats(request):
# def help(request):
# def contact(request):
# def csrf_failure(request, reason=''):


# Path: sparcssso/urls.py
from django.conf import settings, urls
from django.conf.urls.static import static
from django.contrib import admin
from django.shortcuts import render
from django.urls import include, path, re_path
from apps.core.views import general

    path('lang/<str:code>/', general.lang),

    re_path(r'^terms/(?P<version>[\d\.]+)?$', general.terms),
    re_path(r'^privacy/(?P<version>[\d\.]+)?$', general.privacy),

    path('credits/', general.credits),
    path('stats/', general.stats),
    path('help/', general.help),
    path('contact/', general.contact),

    path('account/', include('apps.core.urls')),
    path('api/', include('apps.api.urls')),
    path('dev/', include('apps.dev.urls')),
    path('web-api/', include('apps.web.urls')),

    path('manage/', admin.site.urls),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)


def build_handler(status: int):
    def handler(request, exception=None):
        return render(request, f'error/{status}.html', status=status)
    return handler


urls.handler400 = build_handler(400)

urls.handler403 = build_handler(403)