
from django.urls import path, include

from . import views

from django.views.decorators.cache import cache_page, cache_control
from generic.urls import generic_exam_urls, generic_view_urls

app_name = "shorts"

urlpatterns = [
    #path("", views.GenericExamViews.index, name="index"),
    #path("exam", generic_exam_urls(views.GenericExamViews), name="index"),
    path("question_viewer", views.question_viewer, name="question_viewer"),
    path("question/", views.QuestionView.as_view(), name="question_view"),
    path("question/hash", views.get_question_by_hash, name="question_by_hash"),
    # path("unchecked/", views.unchecked_list, name="unchecked_list"),
    # path("verified/<int:pk>/", views.verified_detail, name="verified_detail"),
    path("question/<int:pk>/json", views.question_json, name="question_json"),
    path(
        "question/<int:pk>/json/unbased",
        views.question_json_unbased,
        name="question_json_unbased",
    ),
    path(
        "question/<int:pk>/save_annotation",
        views.question_save_annotation,
        name="question_save_annotation",
    ),
    path("question/<int:pk>/split", views.question_split, name="question_split"),
    path("question/<int:pk>/clone", views.QuestionClone.as_view(), name="question_clone"),
    # path("verified/", views.verified, name="verified"),
    # path("all_questions/", views.all_questions, name="all_questions"),
    path(
        "question/<int:pk>/delete",
        views.QuestionDelete.as_view(),
        name="question_delete",
    ),
    path(
        "question/<int:pk>/anon",
        views.question_anonymise_dicom,
        name="question_anonymise_dicom",
    ),
    path(
        "question/<int:question_id>/add_exam",
        views.question_add_exam,
        name="question_add_exam",
    ),
    path('question/<int:question_id>/combine-images/', views.combine_images_side_by_side, name='combine_images_side_by_side'),
    #path("answer/<int:answer_id>/confirm", views.confirm_answer, name="confirm_answer"),
    #path("answer/<int:answer_id>/delete", views.delete_answer, name="delete_answer"),
    path(
        "exam/<int:exam_id>/<int:question_number>/<int:answer_id>/mark",
        views.mark_answer,
        name="mark_answer",
    ),
    path(
        "exam/<int:exam_id>/<int:question_number>/<int:answer_id>/mark_override",
        views.mark_answer_override,
        name="mark_answer_override",
    ),
    path("exam/<int:exam_pk>/<int:sk>/mark", views.mark, name="mark"),
    path("exam/<int:exam_pk>/<int:sk>/mark/all", views.mark_all, name="mark_all"),
    path(
        "exam/<int:exam_pk>/<int:sk>/mark/review", views.mark_review, name="mark_review"
    ),
    path("exam/<int:pk>/markers", views.ExamMarkersUpdate.as_view(), name="exam_markers"),
    path("exam/<int:pk>/groups", views.ExamGroupsUpdate.as_view(), name="exam_groups_edit"),
    path("exam/<int:pk>/authors", views.ExamAuthorUpdate.as_view(), name="exam_authors"),
    path("exam/create", views.ExamCreate.as_view(), name="exam_create"),
    path("exam/<int:exam_id>/clone", views.ExamClone.as_view(), name="exam_clone"),
    path("exam/<int:pk>/update", views.ExamUpdate.as_view(), name="exam_update"),
    path("exam/<int:pk>/delete", views.ExamDelete.as_view(), name="exam_delete"),
    path("create/", views.QuestionCreate.as_view(), name="question_create"),
    path("create/exam/<int:pk>", views.QuestionCreate.as_view(), name="question_create_exam"),
    #path("region/create/", views.create_region, name="create_region"),
    #path("region/ajax/get_region_id", views.get_region_id, name="get_region_id"),
    #path("abnormality/create/", views.create_abnormality, name="create_abnormality"),
    #path(
    #    "abnormality/ajax/get_abnormality_id",
    #    views.get_abnormality_id,
    #    name="get_abnormality_id",
    #),
    #path("examination/create/", views.create_examination, name="create_examination"),
    #path(
    #    "examination/ajax/get_examination_id",
    #    views.get_examination_id,
    #    name="get_examination_id",
    #),
    path(
        "question/<int:pk>/update",
        views.QuestionUpdate.as_view(),
        name="question_update",
    ),
    path(
        "question/<int:pk>/sample_answers",
        views.QuestionSampleAnswerUpdate.as_view(),
        name="question_sample_answers",
    ),
    #path(
    #    "question/<int:pk>/update_answers",
    #    views.QuestionAnswerUpdate.as_view(),
    #    name="question_answer_update",
    #),
    path(
        "user_answers/",
        views.UserAnswerTableView.as_view(),
        name="user_answer_table_view",
    ),
    path(
        "user_answers/<int:pk>", views.UserAnswerView.as_view(), name="user_answer_view"
    ),
    path(
        "user_answers/<int:pk>/delete",
        views.UserAnswerDelete.as_view(),
        name="user_answer_delete",
    ),
    path(
        "question/<int:question_id>/findings",
        views.question_findings,
        name="question_findings",
    ),

    path(
        "question/add_finding",
        views.create_findings,
        name="add_finding",
    ),
    path(
        "question/delete_finding/<int:pk>",
        views.FindingDelete.as_view(),
        name="delete_finding",
    ),
    path(
        "question/<int:question_id>/<int:finding_pk>",
        views.question_findings,
        name="question_edit_finding",
    ),
    #path(
    #    "answer-autocomplete",
    #    views.AnswerAutocomplete.as_view(
    #        model=Answer, create_field="answer"
    #    ),
    #    name="answer-autocomplete",
    #),
]

urlpatterns.extend(generic_view_urls(views.GenericViews))
urlpatterns.extend(generic_exam_urls(views.GenericExamViews))