"""This module holds the urls for the ``api`` app."""

from django.conf.urls import include, url

from . import views

# Urls with v1.0 prefix
v1_prefixed_urlpatterns = [
    url(r'', include('mtp.apps.brainstormers.api.urls')),
    url(r'', include('mtp.apps.roleplays.api.urls')),
    url(r'', include('mtp.apps.surveys.api.urls')),
    url(r'', include('mtp.apps.themes.api.urls')),
    url(r'', include('mtp.apps.translation.api.urls')),
    url(
        r'sessions/(?P<session_id>[-\w]+)/trainees/(?P<trainee_id>[-\w]+)/assessment$',
        views.AssessmentDebrief.as_view(),
        name='assessment_debrief'
    ),
]

# Urls for apiv1
apiv1_urlpatterns = [
    url(r'', include('mtp.apps.accounts.api.urls')),
    url(r'', include('mtp.apps.documents.api.urls')),
    url(r'', include('mtp.apps.evaluations.api.urls')),
    url(r'', include('mtp.apps.metaplans.api.urls')),
    url(r'', include('mtp.apps.trainings.api.urls')),
    url(r'', include('mtp.apps.workshops.api.urls')),
    url(r'downloads/(?P<file_id>[-\w]+)$', views.downloads, name='downloads'),
    url(r'ping$', views.ping, name='ping'),
    url(r'shutdown$', views.stop_server),
    url(r'upload$', views.upload_file, name='upload_file'),
    url(r'upload/(?P<folder_name>[-\w]+)$', views.upload_post, name='upload_post'),
    url(r'v1.0/', include(v1_prefixed_urlpatterns)),
]


# These are the new v2.0 api urls \o/
apiv2_urlpatterns = [
    url(r'', include('mtp.apps.accounts.apiv2.urls')),
]

# Urls with v2.0 prefix
v2_prefixed_urlpatterns = [
    url(r'', include(apiv2_urlpatterns, namespace='apiv2')),
    url(r'oauth/', include('oauth2_provider.urls', namespace='oauth2_provider')),
]

urlpatterns = [
    url(r'', include(apiv1_urlpatterns, namespace='api')),
    url(r'docs/', include('rest_framework_swagger.urls')),
    url(r'v2.0/', include(v2_prefixed_urlpatterns)),
]
