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

from macrosurl import url

from mtp.apps.ideas.views import (
    BrainstormingCreateView,
    QuestionWallCreateView,
    WordCloudCreateView
)
from mtp.apps.evaluations.views import EvaluationCreate
from mtp.apps.media.views import PresentationCreateView, VideoCreateView
from mtp.apps.photostories.views import PhotostoryCreateView
from mtp.apps.questionnaires.views import (
    LivePollingCreate,
    LiveQuizCreate,
    PollingCreate,
    QuizCreate,
)
from mtp.apps.roleplays.views import RoleplayCreate
from mtp.apps.surveys.views import TrainingSurveyView

from . import views


app_name = 'trainings'

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.TrainingDetailView.as_view(),
        name='training-detail'
    ),
    url(
        r'^:training_uuid/update/$',
        views.TrainingUpdateView.as_view(),
        name='training-update'
    ),
    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'^:training_uuid/activities/add/$',
        views.TrainingActivitiesAddView.as_view(),
        name='activities-add'
    ),
    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'^activities/:activity_uuid/delete/',
        views.TrainingActivityDeleteView.as_view(),
        name='activity-delete'
    ),
    url(
        r'^activities/:activity_uuid/training-duplicate/:training_uuid/',
        views.TrainingActivityTrainingDuplicateView.as_view(),
        name='training-activity-duplicate'
    ),
    url(
        r'^activities/:activity_uuid/trainings-duplicate/',
        views.TrainingActivityTrainingsDuplicateView.as_view(),
        name='trainings-activity-duplicate'
    ),
    url(
        r'^activities/:activity_uuid/private-library-duplicate/',
        views.TrainingActivityPrivateLibraryDuplicateView.as_view(),
        name='private-library-activity-duplicate'
    ),
    url(
        r'^activities/:activity_uuid/public-library-duplicate/',
        views.TrainingActivityPublicLibraryDuplicateView.as_view(),
        name='public-library-activity-duplicate'
    ),
    url(
        r'^activities/library/private/',
        views.PrivateLibraryView.as_view(),
        name='activities-private-library'
    ),
    url(
        r'^activities/library/public/',
        views.PublicLibraryView.as_view(),
        name='activities-public-library'
    ),

    # 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/whoswho/$',
        views.TrainingSessionWhosWho.as_view(),
        name='session-whoswho'
    ),
    url(
        r'^sessions/:session_uuid/token/$',
        views.SessionTokenView.as_view(),
        name='session-token',
    ),
    url(
        r'^sessions/:session_uuid/results-export/$',
        views.TrainingSessionResultsExportView.as_view(),
        name='session-results-export',
    ),

    # 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/brainstorming/$',
        BrainstormingCreateView.as_view(),
        name='brainstorming-create'
    ),
    url(
        r'^:training_uuid/questionwall/$',
        QuestionWallCreateView.as_view(),
        name='questionwall-create'
    ),
    url(
        r'^:training_uuid/wordcloud/$',
        WordCloudCreateView.as_view(),
        name='wordcloud-create'
    ),
    url(
        r'^:training_uuid/evaluations/$',
        EvaluationCreate.as_view(),
        name='evaluation-create'
    ),
    url(
        r'^:training_uuid/presentation/$',
        PresentationCreateView.as_view(),
        name='presentation-create'
    ),
    url(
        r'^:training_uuid/photostories/$',
        PhotostoryCreateView.as_view(),
        name='photostory-create'
    ),
    url(
        r'^:training_uuid/roleplays/$',
        RoleplayCreate.as_view(),
        name='roleplay-create'
    ),
    url(
        r'^:training_uuid/video/$',
        VideoCreateView.as_view(),
        name='video-create'
    ),
    url(
        r'^:training_uuid/quiz/$',
        QuizCreate.as_view(),
        name='quiz-create'
    ),
    url(
        r'^:training_uuid/livequiz/$',
        LiveQuizCreate.as_view(),
        name='livequiz-create'
    ),
    url(
        r'^:training_uuid/polling/$',
        PollingCreate.as_view(),
        name='polling-create'
    ),
    url(
        r'^:training_uuid/livepolling/$',
        LivePollingCreate.as_view(),
        name='livepolling-create'
    ),
]
