"""This module holds the apiv2 urls of the ``trainings`` app."""

from macrosurl import url
from rest_framework_extensions.routers import ExtendedSimpleRouter

from . import views

router = ExtendedSimpleRouter()

router.register(
    r'trainings',
    views.TrainingViewSet,
    base_name='training'
)

router.register(
    r'sessions',
    views.SessionViewSet,
    base_name='session'
).register(
    r'trainees',
    views.TraineeViewSet,
    base_name='session-trainee',
    parents_query_lookups=['training_sessions'],
)
router.register(r'sessions/tokens', views.TokenViewSet, base_name='token')

urlpatterns = [
    url(
        r'sessions/:session_uuid/:user_uuid/users_status/',
        views.SessionUsersStatusView.as_view(),
        name='session-users-status'
    )
] + router.urls
