# Path: pttrack/urls.py
# def wrap_url(url, no_wrap=[], login_only=[], provider_only=[],
#              updated_provider_only=[]):
#     '''
#     Wrap URL in decorators as appropriate.
#     '''
#     if url.name in no_wrap:
#         # do not wrap at all, fully public
#         pass
# 
#     elif url.name in login_only:
#         url.callback = login_required(url.callback)
# 
#     elif url.name in provider_only:
#         url.callback = provider_required(url.callback)
#         url.callback = login_required(url.callback)
# 
#     elif url.name in updated_provider_only:
#         url.callback = provider_update_required(url.callback)
#         url.callback = provider_required(url.callback)
#         url.callback = login_required(url.callback)
# 
#     else:  # wrap in everything
#         url.callback = clintype_required(url.callback)
#         url.callback = provider_update_required(url.callback)
#         url.callback = provider_required(url.callback)
#         url.callback = login_required(url.callback)
# 
#     return url


from django.conf.urls import url
from pttrack.urls import wrap_url
from django.views.generic import DetailView
from . import models
from . import views
unwrapped_urlconf = [
    url(r'^new-note/(?P<pt_id>[0-9]+)/$',
        views.new_note_dispatch,
        name='new-note-dispatch'),

    url(r'^new/(?P<pt_id>[0-9]+)/$',
        views.WorkupCreate.as_view(),
        name='new-workup'),
    url(r'^(?P<pk>[0-9]+)/$',
        DetailView.as_view(model=models.Workup),
        name='workup'),
    url(r'^(?P<pk>[0-9]+)/update/$',
        views.WorkupUpdate.as_view(),
        name='workup-update'),
    url(r'^(?P<pk>[0-9]+)/sign/$',
        views.sign_workup,
        name='workup-sign'),
    url(r'^(?P<pk>[0-9]+)/error/$',
        views.error_workup,
        name="workup-error"),
    url(r'^(?P<pk>[0-9]+)/pdf/$',
        views.pdf_workup,
        name="workup-pdf"),

    # PROGRESS NOTES
    url(r'^(?P<pt_id>[0-9]+)/psychnote/$',
        views.ProgressNoteCreate.as_view(),
        name="new-progress-note"),
    url(r'^psychnote/update/(?P<pk>[0-9]+)$',
        views.ProgressNoteUpdate.as_view(),

# Path: pttrack/urls.py
# def wrap_url(url, no_wrap=[], login_only=[], provider_only=[],
#              updated_provider_only=[]):
#     '''
#     Wrap URL in decorators as appropriate.
#     '''
#     if url.name in no_wrap:
#         # do not wrap at all, fully public
#         pass
# 
#     elif url.name in login_only:
#         url.callback = login_required(url.callback)
# 
#     elif url.name in provider_only:
#         url.callback = provider_required(url.callback)
#         url.callback = login_required(url.callback)
# 
#     elif url.name in updated_provider_only:
#         url.callback = provider_update_required(url.callback)
#         url.callback = provider_required(url.callback)
#         url.callback = login_required(url.callback)
# 
#     else:  # wrap in everything
#         url.callback = clintype_required(url.callback)
#         url.callback = provider_update_required(url.callback)
#         url.callback = provider_required(url.callback)
#         url.callback = login_required(url.callback)
# 
#     return url


# Path: workup/urls.py
from django.conf.urls import url
from pttrack.urls import wrap_url
from django.views.generic import DetailView
from . import models
from . import views

unwrapped_urlconf = [
    url(r'^new-note/(?P<pt_id>[0-9]+)/$',
        views.new_note_dispatch,
        name='new-note-dispatch'),

    url(r'^new/(?P<pt_id>[0-9]+)/$',
        views.WorkupCreate.as_view(),
        name='new-workup'),
    url(r'^(?P<pk>[0-9]+)/$',
        DetailView.as_view(model=models.Workup),
        name='workup'),
    url(r'^(?P<pk>[0-9]+)/update/$',
        views.WorkupUpdate.as_view(),
        name='workup-update'),
    url(r'^(?P<pk>[0-9]+)/sign/$',
        views.sign_workup,
        name='workup-sign'),
    url(r'^(?P<pk>[0-9]+)/error/$',
        views.error_workup,
        name="workup-error"),
    url(r'^(?P<pk>[0-9]+)/pdf/$',
        views.pdf_workup,
        name="workup-pdf"),

    # PROGRESS NOTES
    url(r'^(?P<pt_id>[0-9]+)/psychnote/$',
        views.ProgressNoteCreate.as_view(),
        name="new-progress-note"),
    url(r'^psychnote/update/(?P<pk>[0-9]+)$',
        views.ProgressNoteUpdate.as_view(),

        name="progress-note-update"),