"""This module holds the urls for the ``roleplays`` app

The following views are defined:

- /roleplays/add/ : named "roleplay-create"
  => used to create a roleplay
- /roleplays/:uuid/ : named "roleplay-detail"
  => used to view the detail of a roleplay
- /roleplays/:uuid/update : named "roleplay-update"
  => used to update a roleplay
- /roleplays/:uuid/delete/ : named "roleplay-delete"
  => used to delete a roleplay, with a confirmation step

- /roleplays/:uuid/step/create/: named "step-create"
  => used to create a new step for the given roleplay
- /roleplays/:uuid/step/sort/: named "steps-sort"
  => used to sort the steps related to the given roleplay
- /roleplays/:uuid/step/:step_uuid/: named "step-edit"
  => used to update a step
- /roleplays/:uuid/step/:step_uuid/delete/: named "step-delete"
  => used to delete a step

- /roleplays/roleplay_uuid/step/:step_uuid/criterion/create/: named "criterion-create"
  => used to create a criterion
- /roleplays/roleplay_uuid/step/:step_uuid/criterion/:criterion_uuid/: named "criterion-update"
  => used to update a criterion
- /roleplays/roleplay_uuid/step/:step_uuid/criterion/:criterion_uuid/delete/:
  named "criterion-delete"
  => used to delete a criterion

Notes
-----
We use ``django-macros-url`` to ease the use of parameters in urls, for example UUIDs:
``:uuid`` is more readable than
``(?P<uuid>[a-fA-F0-9]{8}-?[a-fA-F0-9]{4}-?[a-fA-F0-9]{4}-?[a-fA-F0-9]{4}-?[a-fA-F0-9]{12})``

"""

from macrosurl import url

from . import views


app_name = 'roleplays'

urlpatterns = [
    url(
        r'^:roleplay_uuid/$',
        views.RoleplayDetail.as_view(),
        name='roleplay-detail'
    ),
    url(
        r'^:roleplay_uuid/update/$',
        views.RoleplayUpdate.as_view(),
        name='roleplay-update'
    ),
    url(
        r'^:roleplay_uuid/step/create/$',
        views.StepCreate.as_view(),
        name='step-create'
    ),
    url(
        r'^:roleplay_uuid/steps/sort/$',
        views.StepsSort.as_view(),
        name='steps-sort'
    ),
    url(
        r'^:roleplay_uuid/step/:step_uuid/$',
        views.StepUpdate.as_view(),
        name='step-update'
    ),
    url(
        r'^:roleplay_uuid/step/:step_uuid/delete/$',
        views.StepDelete.as_view(),
        name='step-delete'
    ),
    url(
        r'^:roleplay_uuid/step/:step_uuid/criterion/create/$',
        views.CriterionCreate.as_view(),
        name='criterion-create'
    ),
    url(
        r'^:roleplay_uuid/step/:step_uuid/criteria/sort/$',
        views.CriteriaSort.as_view(),
        name='criteria-sort'
    ),
    url(
        r'^:roleplay_uuid/step/:step_uuid/criterion/:criterion_uuid/$',
        views.CriterionUpdate.as_view(),
        name='criterion-update'
    ),
    url(
        r'^:roleplay_uuid/step/:step_uuid/criterion/:criterion_uuid/delete/$',
        views.CriterionDelete.as_view(),
        name='criterion-delete'
    ),

    # Import/Export roleplay
    url(
        r'^trainings/:training_uuid/import_xls$',
        views.XLSRoleplayImportView.as_view(),
        name='import-xls'
    ),
    url(
        r'^:roleplay_uuid/export_xls$',
        views.XLSRoleplayExportView.as_view(),
        name='export-xls'
    )
]
