from typing import *

from django.urls import path, include
from django.views.decorators.csrf import csrf_exempt

from .views import (
    app_settings_all_view, user_settings_all_view,
    app_settings_set_view, user_settings_set_view,
)


__all__ = 'make_urlpatterns',

APP_LABEL = 'wcd_settings'
V1_PREFIX = 'api/v1/settings/'
V1_NAMESPACE = 'wcd-settings-api-v1'


def make_urlpatterns(
    app_settings_all=app_settings_all_view,
    app_settings_set=app_settings_set_view,
    user_settings_all=user_settings_all_view,
    user_settings_set=user_settings_set_view,

    v1_prefix=V1_PREFIX,
):
    app = [
        path('all/', csrf_exempt(app_settings_all), name='all'),
        path('set/', csrf_exempt(app_settings_set), name='set'),
    ]
    own = [
        path('all/', csrf_exempt(user_settings_all), name='all'),
        path('set/', csrf_exempt(user_settings_set), name='set'),
    ]

    return [path(v1_prefix, include(([
        path('app/', include((app, APP_LABEL), namespace='app')),
        path('own/', include((own, APP_LABEL), namespace='own')),
    ], APP_LABEL), namespace=V1_NAMESPACE))]
