# (c) cavaliba.com - data - urls.py

from django.urls import path

from app_data import views
from app_data import views_editor
from app_data import ajax
from app_data import views_task

# url namespace
app_name="app_data"

urlpatterns = [

    path('',  views.private, name='private'),

    # anon
    #path('anon',  views.anonymous, name='anonymous'),

    # PRIVATE
    path('private/', views.private, name='private'),
    path('private/', views.private, name='class_list'),
    path('private/instance/detail/<int:id>/', views.instance_detail, name='instance_detail'),
    path('private/instance/edit/<int:id>/', views.instance_edit, name='instance_edit'),
    path('private/instance/delete/<int:id>/', views.instance_delete, name='instance_delete'),
    path('private/instance/enable/<int:id>/', views.instance_enable, name='instance_enable'),
    path('private/instance/disable/<int:id>/', views.instance_disable, name='instance_disable'),

    path('private/schema/list/<slug:classname>/', views.instance_list, name='instance_list'),
    # backward compat with home/dashboard 
    path('private/c/<slug:classname>/list/', views.instance_list, name='instance_list'),
    path('private/schema/new/<slug:classname>', views.instance_new, name='instance_new'),
    
    path('private/file/<str:fileid>/', views.file_display, name='file_display'),

    # YAML / texteditor
    path('private/texteditor/', views_editor.texteditor, name='texteditor'),
    path('private/texteditor/<int:id>/', views_editor.texteditor, name='texteditor'),
    path('private/texteditor/<slug:classname>/', views_editor.texteditor, name='texteditor'),
    path('private/texteditor/<slug:classname>/<int:id>/', views_editor.texteditor, name='texteditor'),
    path('private/import/', views_editor.texteditor, name='data_import'),

    # export
    path('private/export/', views.data_export, name='data_export'),

    # ajax
    path('private/ajax/', ajax.ajax_instance, name='ajax_instance'),

    # tasks - v3.33
    path('private/tasks/', views_task.task_list, name='task_list'),
    path('private/tasks/navbar/', views_task.task_navbar_partial, name='task_navbar_partial'),
    path('private/tasks/<uuid:handle>/', views_task.task_detail, name='task_detail'),
    path('private/tasks/<uuid:handle>/stop/', views_task.task_stop, name='task_stop'),


]
