"""This module holds the urls for the ``trainings`` app."""

from macrosurl import url

from mtp.apps.brainstormers.views import BrainstormerTemplateCreateView
from mtp.apps.documents.views import DocumentCreateView
from mtp.apps.evaluations.views import EvaluationCreate
from mtp.apps.metaplans.views import MetaplanTemplateCreateView
from mtp.apps.roleplays.views import RoleplayCreate
from mtp.apps.surveys.views import TrainingSurveyView
from mtp.apps.workshops.views import WorkshopCreate

from . import views


urlpatterns = [

    # Training-related URLs
    # ---------------------

    url(
        r'^create/$',
        views.TrainingCreateView.as_view(),
        name='training-create'
    ),
    url(
        r'^:training_uuid/delete/$',
        views.TrainingDeleteView.as_view(),
        name='training-delete'
    ),
    url(
        r'^:training_uuid/$',
        views.TrainingUpdateView.as_view(),
        name='training-detail'
    ),
    url(
        r'^:training_uuid/draft/$',
        views.TrainingCreateDraftView.as_view(),
        name='training-draft'
    ),
    url(
        r'^:training_uuid/duplicate/$',
        views.TrainingDuplicateView.as_view(),
        name='training-duplicate'
    ),
    url(
        r'^:training_uuid/publish-duplicate/$',
        views.TrainingPublishDuplicateView.as_view(),
        name='training-publish-duplicate'
    ),
    url(
        r'^:training_uuid/options/:options_uuid/$',
        views.TrainingOptionsEditView.as_view(),
        name='options-edit'
    ),
    url(
        r'^$',
        views.TrainingListView.as_view(),
        name='training-list'
    ),
    url(
        r'^waiting-and-recents/$',
        views.WaitingAndRecentTrainingsJsonView.as_view(),
        name='waiting-and-recents',
    ),
    url(
        r'^:training_uuid/publish/$',
        views.TrainingPublishView.as_view(),
        name='training-publish'
    ),
    url(
        r'^:training_uuid/archive/$',
        views.TrainingArchiveView.as_view(),
        name='training-archive'
    ),

    # TrainingActivity-related URLs
    # -----------------------------

    url(
        r'^:training_uuid/activities/:activity_uuid/delete/',
        views.TrainingActivityDeleteView.as_view(),
        name='activity-delete'
    ),
    url(
        r'^:training_uuid/activities/:activity_uuid/duplicate/',
        views.TrainingActivityDuplicateView.as_view(),
        name='activity-duplicate'
    ),
    url(
        r'^:training_uuid/activities/',
        views.TrainingActivityListView.as_view(),
        name='activity-list'
    ),

    # QRCode-related urls
    url(
        r'^:training_uuid/activities/:activity_uuid/qrcode/',
        views.ActivityQRCodeDownloadDetailView.as_view(),
        name='download-launch-qrcode-detail'
    ),
    url(
        r'^:training_uuid/activities/qrcode/',
        views.ActivityQRCodeDownloadListView.as_view(),
        name='download-launch-qrcode-list'
    ),

    # Session-related URLs
    # --------------------

    url(
        r'^sessions/add/$',
        views.TrainingSessionCreate.as_view(),
        name='session-add'
    ),
    url(
        r'^:training_uuid/sessions/create/$',
        views.TrainingSessionCreate.as_view(),
        name='session-create'
    ),
    url(
        r'^sessions/:session_uuid/close/$',
        views.TrainingSessionClose.as_view(),
        name='session-close'
    ),
    url(
        r'^sessions/:session_uuid/delete/$',
        views.TrainingSessionDelete.as_view(),
        name='session-delete'
    ),
    url(
        r'^sessions/:session_uuid/$',
        views.TrainingSessionUpdate.as_view(),
        name='session-detail'
    ),
    url(
        r'^sessions/$',
        views.TrainingSessionList.as_view(),
        name='session-list'
    ),
    url(
        r'^:training_uuid/sessions/$',
        views.TrainingSessionList.as_view(),
        name='session-list'
    ),
    url(
        r'^sessions/:session_uuid/podium/$',
        views.TrainingSessionPodium.as_view(),
        name='session-podium'
    ),
    url(
        r'^sessions/:session_uuid/whoswho/$',
        views.TrainingSessionWhosWho.as_view(),
        name='session-whoswho'
    ),
    url(
        r'^sessions/:session_uuid/photostory/$',
        views.TrainingSessionExportPhotostory.as_view(),
        name='session-photostory-export'
    ),
    url(
        r'^sessions/:session_uuid/token/$',
        views.SessionTokenView.as_view(),
        name='session-token',
    ),
    url(
        r'^sessions/:session_uuid/trainees/:trainee_uuid/download/$',
        views.session_trainee_content,
        name='session-trainee-content'
    ),
    url(
        r'^sessions/:session_uuid/users/import/$',
        views.session_users_import,
        name='session-users-import'
    ),

    # Url to edit the survey of a training for a trainer.
    url(
        r'^:training_uuid/survey/$',
        TrainingSurveyView.as_view(),
        name='training-survey'
    ),

    # Activity-related URLs (located in others apps)
    # -------------------------------------------------

    url(
        r'^:training_uuid/brainstormer-templates/$',
        BrainstormerTemplateCreateView.as_view(),
        name='brainstormer-template-create'
    ),
    url(
        r'^:training_uuid/documents/$',
        DocumentCreateView.as_view(),
        name='document-create'
    ),
    url(
        r'^:training_uuid/evaluations/$',
        EvaluationCreate.as_view(),
        name='evaluation-create'
    ),
    url(
        r'^:training_uuid/metaplan-templates/$',
        MetaplanTemplateCreateView.as_view(),
        name='metaplan-template-create'
    ),
    url(
        r'^:training_uuid/roleplays/$',
        RoleplayCreate.as_view(),
        name='roleplay-create'
    ),
    url(
        r'^:training_uuid/workshops/$',
        WorkshopCreate.as_view(),
        name='workshop-create'
    ),
]
