"""
References URL configuration
"""
from django.urls import path

from . import views, ui_views

app_name = 'references'

# API Endpoints
urlpatterns_api = [
    path('api/folders/', views.folder_list, name='api_folder_list'),
    path('api/folders/<uuid:pk>/', views.folder_detail, name='api_folder_detail'),
    path('api/documents/', views.document_list, name='api_document_list'),
    path('api/documents/<uuid:pk>/', views.document_detail, name='api_document_detail'),
    path('api/documents/<uuid:pk>/download/', views.document_download, name='api_document_download'),
    path('api/documents/<uuid:pk>/versions/', views.document_version_history, name='api_document_versions'),
]

# UI Views
urlpatterns_ui = [
    # Dashboard
    path('', ui_views.reference_dashboard, name='dashboard'),

    # Folders
    path('folders/', ui_views.folder_view, name='folder_view'),
    path('folders/new/', ui_views.folder_create, name='folder_create'),
    path('folders/new/<uuid:parent_pk>/', ui_views.folder_create, name='folder_create_in_parent'),
    path('folders/<uuid:pk>/', ui_views.folder_view, name='folder_view'),
    path('folders/<uuid:pk>/edit/', ui_views.folder_edit, name='folder_edit'),
    path('folders/<uuid:pk>/delete/', ui_views.folder_delete, name='folder_delete'),

    # Documents
    path('documents/new/', ui_views.document_create, name='document_create'),
    path('documents/new/<uuid:folder_pk>/', ui_views.document_create, name='document_create_in_folder'),
    path('documents/<uuid:pk>/', ui_views.document_view, name='document_view'),
    path('documents/<uuid:pk>/edit/', ui_views.document_edit, name='document_edit'),
    path('documents/<uuid:pk>/delete/', ui_views.document_delete, name='document_delete'),

    # Search
    path('search/', ui_views.search, name='search'),
]

urlpatterns = urlpatterns_ui + urlpatterns_api
